簡體   English   中英

開發部署抱怨關閉

[英]dev deploy complaining about closures

我運行了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。 我希望我向任何可以提供幫助的人提供了足夠的信息。

問題在於routes\\api.php

做一些類似Route::middleware('auth:api')->get('/user', 'MyProfileController@index'); . 此路由需要綁定到控制器。 如果您不需要該路線,請評論或刪除它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM