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
Title should probably specify Laravel '4' but thanks tho :)
Thanks!
Thanks!!
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..
Have a fresh tip? Share with Coderwall community!
PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.
Security insights from Cside