I have a login form and after the form submission (if validation is OK) the browser should redirect to the last page before login. Currently I redirect back and I get always into the same login page. My routes.php is something like this:
Route::get('/', 'HomeController@index');
Route::get('/list','EventController@index');
Route::get('/login','AuthController@login');
Route::post('/login','AuthController@do_login');
And my Redirection inside do_login() is
if(Login_is_valid())
{
return Redirect::back();
}
If I'm inside /list page and then open Login and fill the form correctly I'm redirected to /login again isn't it weird? Many thanks
Hello if you use Laravel 5.1 you can redirect to previous page next way
return back();
or you can use Session where Laravel save previous page
return redirect(Session::get('_previous')['url']);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With