In Laravel 4.0 my routes file looks like this:
Route::group(['prefix' => 'v1'], function(){
// define the user resource with no system
Route::resource('users', 'UserController');
Route::get('me', function () {
$r = URL::action('UserController@show', [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');
});
});
Which worked perfectly,
because I only passed in one parameter to the URL::action method parameters array in the /me route it would use the system-less Route::resource('users...` and if I was to pass in two it would use the system-prefixed version.
But in Laravel 4.1 instead it is returning the route
/v1/systems/[the user id]/users/{users} (the literal placeholder {users}).
What has caused this change/how can I fix it?
Both sets of routes are being registered as the output of php artisan routes has:
GET v1/users | v1.users.index | UserController@index
GET v1/users/create | v1.users.create | UserController@create
POST v1/users | v1.users.store | UserController@store
GET v1/users/{users} | v1.users.show | UserController@show
GET v1/users/{users}/edit | v1.users.edit | UserController@edit
PUT v1/users/{users} | v1.users.update | UserController@update
PATCH v1/users/{users} | | UserController@update
GET v1/systems/{systems}/users | v1.systems.{systems}.users.index | UserController@index
POST v1/systems/{systems}/users | v1.systems.{systems}.users.store | UserController@store
GET v1/systems/{systems}/users/{users} | v1.systems.{systems}.users.show | UserController@show
PUT v1/systems/{systems}/users/{users} | v1.systems.{systems}.users.update | UserController@update
PATCH v1/systems/{systems}/users/{users} | | UserController@update
DELETE v1/systems/{systems}/users/{users} | v1.systems.{systems}.users.destroy | UserController@destroy
:systemsinstead of{systems}- Got The Fever Media