我試圖在我的控制器中使用GET|POST|PUT|DELETE
。Laravel:結構和組織routes.php
我覺得我的routes.php
文件會變得混亂,因爲我的項目越來越大,因爲我將不得不爲所有GET|POST...
請求註冊大量路由。
這是我現在使用的結構:
<?php
/*
|--------------------------------------------------------------------------
| Home Routes
|--------------------------------------------------------------------------
*/
//Get
Route::get('/', '[email protected]');
Route::get('/home/logout', '[email protected]');
//Post
Route::post('/home/login', '[email protected]');
/*
|--------------------------------------------------------------------------
| Appointment Routes
|--------------------------------------------------------------------------
*/
//Get
Route::get('appointments', '[email protected]');
有沒有更好的辦法做到這一點?我怎樣才能組織/改進這個文件?
你能給我一些建議嗎?謝謝!
我認爲你正在尋找RESTful /資源豐富的控制器:http://laravel.com/docs/controllers#restful-controllers – Quasdunk