Last Updated: February 25, 2016
·
7.43K
· searsaw

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.

5 Responses
Add your response

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 ·