Skip to content

Instantly share code, notes, and snippets.

@inxilpro
Last active September 29, 2017 14:13
Show Gist options
  • Select an option

  • Save inxilpro/35a852a425e2682e9cdee76ad44ea856 to your computer and use it in GitHub Desktop.

Select an option

Save inxilpro/35a852a425e2682e9cdee76ad44ea856 to your computer and use it in GitHub Desktop.
Laravel "was()" concept
<?php
// Redirect /bar to /foo
Route::get('/foo', 'FooController')->was('/bar');
// Redirect /my-dashboard to /account/dashboard
// It seems like 'was' should always be absolute, even in a group
Route::group(['prefix' => 'account'], function() {
Route::get('/dashboard', [
'as' => 'account.dashboard',
'uses' => 'DashboardController@index',
'was' => '/my-dashboard',
]);
});
// Redirect /user-activity/3 to /users/3/activity
Route::get('/users/{user}/activity')->was('/user-activity/{user}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment