开发部署抱怨关闭

我跑了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.

我已经研究过了,似乎我不能在路由中使用闭包,这很好。我只是不确定如何防止关闭。


这是我的 web.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.1。我希望我向任何可以提供帮助的人提供了足够的信息。


慕沐林林
浏览 87回答 1
1回答

温温酱

问题出在routes\api.php.做类似的事情Route::middleware('auth:api')->get('/user', 'MyProfileController@index');。此路由需要绑定到控制器。如果您不需要该路线,请评论或删除它。
打开App,查看更多内容
随时随地看视频慕课网APP