路由组以admin为前缀

时间:2015-06-05 04:23:17

标签: laravel laravel-4

如何在路线开头设置管理员,例如路线组集合中的&#39; / admin / attributes / 1 / edit而不仅仅是/ attributes / 1 / edit < / p>

Route::group(array('before' => 'Admin'), function() {
    Route::resource('attributes', 'AttributesController');
    Route::resource('brands', 'BrandsController');
    Route::resource('products', 'ProductsController');
    Route::resource('tags', 'TagsController');
    Route::resource('roles', 'RolesController');
    Route::resource('suppliers', 'SuppliersController');
});

1 个答案:

答案 0 :(得分:4)

您需要使用prefix

Route::group(array('prefix' => 'admin'), function() 
{
    // routes here
});

请参阅Laravel Documentation