我跑了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。我希望我能提供足够的信息给任何可以帮助的人。
答案 0 :(得分:1)
问题出在routes\api.php
上。
执行类似Route::middleware('auth:api')->get('/user', 'MyProfileController@index');
的操作。该路由需要绑定到控制器。如果您不需要路线,请注释或删除。