[Laravel]配置路由小记

时间:2024-03-28 09:06:38

Laravel:4.2

使用的后台是:laravel-backend

php artisan routes

使用这个代码,可以看到显示目前项目的路由器

[Laravel]配置路由小记

,我需要添加功能,我就需要添加路由

/*
|--------------------------------------------------------------------------
| Admin Customer Cpanel Routes
|--------------------------------------------------------------------------
*/
// Route::model('customers', 'Customer');
Route::group(array('prefix' => 'admin', 'before' => 'auth.backend'), function ()
{ Route::group(array('prefix' => 'customers'), function()
{
Route::get('', array('as'=>'admin.customers.index','uses'=>'ACustomerController@index'));
Route::post('', array('as'=>'admin.customers.index','uses'=>'ACustomerController@index'));
Route::get('create', array('as'=>'admin.customers.create','uses'=>'ACustomerController@create'));
Route::get('edit', array('as'=>'admin.customers.edit','uses'=>'ACustomerController@edit'));
Route::get('{$customers}', array('as'=>'admin.customers.show','uses'=>'ACustomerController@show'));
Route::delete('{$customers}', array('as'=>'admin.customers.destroy','uses'=>'ACustomerController@destroy'));
}); //Route::resource('customers', 'ACustomerController');
//Route::get('/customers/index', 'ACustomerController@index');
// Route::get('customers/create', 'ACustomerController@create');
// Route::post('customers/store', 'ACustomerController@store');
// Route::get('customers/edit', 'ACustomerController@edit');
// Route::post('customers/update', 'ACustomerController@update');
// Route::delete('customers/destroy', 'ACustomerController@destroy');
//Route::resource('regions', 'ARegionController');
});

[Laravel]配置路由小记

这是我目前定义的路由,可以正常使用了,哎,老板又开始问进度了,暂时放下Laravel,现在要开始用TP做后台了~~~

嘿嘿,我也只不过是依葫芦画瓢而已~~[Laravel]配置路由小记

参考:Laravel 學習筆記(11) - Route 進階