我要使用资源路由和组前缀
喜欢
Route::group(['prefix' => 'c1'], function () {
Route::resource('locations', 'LocationController');
});
但现在可以正常工作了。
使用像这样的 as 方法可以正常工作
Route::group(['prefix' => 'c1'], function () {
Route::get('locations', ['as' => 'c1.locations.index', 'uses' => 'LocationController@index']);
Route::post('locations', ['as' => 'c1.locations.store', 'uses' => 'LocationController@store']);
Route::get('locations/create', ['as' => 'c1.locations.create', 'uses' => 'LocationController@create']);
Route::put('locations/{dons}', ['as' => 'c1.locations.update', 'uses' => 'LocationController@update']);
});
答案 0 :(得分:1)
尝试一下,它应该可以工作:
Route::group(['prefix' => 'c1'], function () {
Route::resource('locations', 'LocationController', ['as' => 'c1']);
});