如何在laravel 5.2中使用前缀

时间:2018-06-12 16:18:52

标签: php laravel

我正在使用laravel 5.2。我在routes.php中有以下路线

Route::prefix('manage')->group(function () {
    Route::get('/', 'ManageController@index');
    Route::get('/dashboard','ManageController@dashboard')->name('manage.dashboard');

});

然后当我尝试php artisan serve命令时,我的cmd出现以下错误

Method prefix does not exit

如何解决这个问题?

1 个答案:

答案 0 :(得分:4)

请参阅文档https://laravel.com/docs/5.2/routing#route-groups

Route::group(['prefix' => 'manage'], function () {
    Route::get('/', 'ManageController@index');
    Route::get('/dashboard','ManageController@dashboard')->name('manage.dashboard');
});