我有很多这样的路线:
Route::resource('/dashboard/class', 'classController');
Route::get('/dashboard/class/get-by-filter', 'classController@getByFilter');
Route::get('/dashboard/class/get-by-search', 'classController@getBySearch');
...
...
Route::resource('/dashboard/orders', 'OrderController');
Route::get('/dashboard/orders/get-by-filter', 'OrderController@getByFilter');
...
现在我想用前缀、组和资源来写这些,但是这样写时我遇到了问题:
Route::prefix('dashboard')->group(function()
{
Route::prefix('class')->group(function()
{
Route::resource('/', 'classController');
Route::get('/get-by-filter', 'classController@getByFilter');
Route::get('/get-by-search', 'classController@getBySearch');
});
Route::prefix('orders')->group(function()
{
Route::resource('/', 'OrderController');
Route::get('/get-by-filter', 'OrderController@getByFilter');
Route::get('/get-by-search', 'OrderController@getBySearch');
});
});
为什么当我尝试访问这样的显示地址时返回 404:
example.com/dashboard/orders/4