Undocumented Laravel 4 Redirects
While looking through the Laravel source code, I came upon some functions that aren't displayed in the Laravel documentation. They could have some interesting uses. Redirect::home()
is very handy as a shortcut. Check 'em out!
// Redirects back to the named route 'home'
Redirect::home();
// Redirects back to the previous location
Redirect::back();
// Redirects a new response to the current URI
Redirect::refresh();
If you want to get a look at the source in a Laravel installation, it will be in /vendor/laravel/framework/src/Illuminate/Routing/Redirector.php
.
Written by Alex Sears
Related protips
5 Responses

Very useful, thank you
over 1 year ago
·
Title should probably specify Laravel '4' but thanks tho :)
over 1 year ago
·

Thanks!
over 1 year ago
·
Thanks!!
over 1 year ago
·

If you look at the source code of redirector you will notice that these are by default 302 redirects, so be careful if / when you use them..
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#