在Laravel 4.0我的路線文件看起來像這樣:laravel 4.1路由的變化?
Route::group(['prefix' => 'v1'], function(){
// define the user resource with no system
Route::resource('users', 'UserController');
Route::get('me', function() {
$r = URL::action('[email protected]', [Auth::user()->getAuthIdentifier()]);
return Redirect::to($r);
});
Route::group(['prefix' => 'systems/{systems}'], function(){
// define the user resource with a system system
Route::resource('users', 'UserController');
});
});
這完美地工作, 因爲我只在一個參數傳遞給URL::action
方法參數數組中的/我的路線,將使用系統少路線::資源(「用戶...`如果我是兩個人通過,將利用系統前綴版本。
但在Laravel 4.1,而不是它返回的路線
/v1/systems/[the user id]/users/{users}
(文字佔位符{users})。
是什麼導致了這種變化/我該如何解決它?正在註冊
路線的兩組爲php artisan routes
輸出有:
GET v1/users | v1.users.index | [email protected]
GET v1/users/create | v1.users.create | [email protected]
POST v1/users | v1.users.store | [email protected]
GET v1/users/{users} | v1.users.show | [email protected]
GET v1/users/{users}/edit | v1.users.edit | [email protected]
PUT v1/users/{users} | v1.users.update | [email protected]
PATCH v1/users/{users} | | [email protected]
GET v1/systems/{systems}/users | v1.systems.{systems}.users.index | [email protected]
POST v1/systems/{systems}/users | v1.systems.{systems}.users.store | [email protected]
GET v1/systems/{systems}/users/{users} | v1.systems.{systems}.users.show | [email protected]
PUT v1/systems/{systems}/users/{users} | v1.systems.{systems}.users.update | [email protected]
PATCH v1/systems/{systems}/users/{users} | | [email protected]
DELETE v1/systems/{systems}/users/{users} | v1.systems.{systems}.users.destroy | [email protected]
AREN你應該使用':systems'而不是'{systems}' –