In my controller I have a function to login a user.
In case the login was successful I can simply use return Redirect::back()
.
My problem starts when the credentials are incorrect and I want to redirect with a flash message.
I know I can chain the with
method to the Redirect, but that would send the data to the specific view, and NOT to the layout, where the login HTML lies.
I could load a view like so:
$this->layout
->with('flash',$message)
->content = View::make('index');
But I need to redirect back to the referring page.
Is it possible to redirect while passing data to the layout?