我在不同的目录中有两个相同的控制器。
路由适用于:
Route::resource('dashboard/statistic', 'Admin\StatisticController');
Route::resource('statistic', 'StatisticController');
When I run php artisan route:list
我知道,这些路线的路线名称与:statistic
:
statistic.index
statistic.destroy
statistic.edit
我怎样才能做到这一点?
答案 0 :(得分:0)
您可以明确地创建每个路径( Route::get('dashboard/statistic', ['as' => 'dashboard-statistic.index', 'uses' => 'Admin\StatisticController@index']);
Route::delete('dashboard/statistic', ['as' => 'dashboard-statistic.destroy', 'uses' => 'Admin\StatisticController@destroy']);
Route::put('dashboard/statistic', ['as' => 'dashboard-statistic.edit', 'uses' => 'Admin\StatisticController@edit']);
),例如
{{1}}
答案 1 :(得分:-1)
也许
Route::resource('dashboard/statistic', 'Admin\StatisticController',
['admin' => ['create', 'store', 'update', 'destroy']]);
Route::resource('statistic', 'StatisticController');
希望这可以解决您的问题
答案 2 :(得分:-1)
也许这可以解决问题
Route::group(['prefix' => 'dashboard', 'as' => 'dashboard.'], function() {
Route::resource('statistic', 'Admin\StatisticController');
});
将返回名称,例如:
dashboard.statistic.store