Route::group(['as' => 'admin.documents', 'middleware' => 'permissions:volunteer', 'prefix' => 'admin/documents/', 'namespace' => 'Admin/'], function () {
Route::get('', ['uses' => 'AdminDocumentsController@index', 'as' => '', ]);
Route::get('add', ['uses' => 'AdminDocumentsController@create', 'as' => '.create', ]);
Route::post('add', ['uses' => 'AdminDocumentsController@create', 'as' => '.create'
});
如何优化此代码? 也找到命名空间,但AdminDocumentsController看起来不是商品
答案 0 :(得分:1)
将名称空间添加到第一个路由组,然后从使用
中删除管理员Route::group(['namespace' => 'Admin', 'as' => 'admin.documents', 'middleware' => 'permissions:volunteer', 'prefix' => 'admin/documents/'], function () {
Route::get('', ['uses' => 'AdminDocumentsController@index', 'as' => '', ]);
Route::get('add', ['uses' => 'AdminDocumentsController@create', 'as' => '.create', ]);
});