Last active
September 29, 2017 14:13
-
-
Save inxilpro/35a852a425e2682e9cdee76ad44ea856 to your computer and use it in GitHub Desktop.
Laravel "was()" concept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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