dev deploy жалуется на закрытие - PullRequest
0 голосов
/ 01 марта 2020

Я пробежал deb deploy и до этого дошло.

  The command "/usr/bin/php ~/NetTube/releases/1/artisan optimize" failed.

  Exit Code: 1 (General error)

  Host Name: 68.183.20.108

  ================
  Configuration cache cleared!
  Configuration cached successfully!
  Route cache cleared!

  In Route.php line 917:

    Unable to prepare route [api/user] for serialization. Uses Closure.

Я посмотрел на это, и кажется, что я не могу использовать замыкания с маршрутами, что нормально. Я просто не знаю, как предотвратить замыкания.

Это моя сеть. php

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });

Route::get('/','HomeController@index')->name('home');

Auth::routes();

// Route::get('/home', 'HomeController@index')->name('home');

Route::group(['middleware' => ['auth']], function(){
    Route::get('/upload','VideoUploadController@index');

    Route::get('/channel/{channel}/edit','ChannelSettingsController@edit');
    Route::put('/channel/{channel}/edit','ChannelSettingsController@update');
});


Route::get('/channel/{channel}','ChannelController@index');
Route::get('/{channel}','ChannelController@index');

Я пытался поместить маршруты не в группу с

Route::get('/upload', [
    'uses' => 'VideoUploadController@index',
    'middleware' => ['auth'],
]);

Route::get('/channel/{channel}/edit', [
    'uses' => 'ChannelSettingsController@edit',
    'middleware' => ['auth'],
]);

Route::put('/channel/{channel}/edit', [
    'uses' => 'ChannelSettingsController@update',
    'middleware' => ['auth'],
]);

Я бегу laravel 6.17 0,1. Я надеюсь, что дал достаточно информации любому, кто может помочь.

1 Ответ

1 голос
/ 01 марта 2020

проблема заключается в routes\api.php.

Сделайте что-то вроде Route::middleware('auth:api')->get('/user', 'MyProfileController@index');. Этот маршрут должен быть привязан к контроллеру. Если вам не нужен маршрут, прокомментируйте или удалите его.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...