I have a registration form which after pressing 'submit' button shows some messages - if passed password is too short or if registration is successful. For errors I use withErrors()
method, which works correctly. When I'm trying to pass other variable to session using either
return Redirect::to('login')->with('success', [/**/])
or
return Redirect::to('login')->withSuccess([/**/])
variables in my view seem unset.
If you want to pass messages with session you can follow this:
In Controller:
Session::flash('message', 'error message here......');
In view:
{{Session::get("message")}}
This one show the error message .Try this.thanks.
you can set success message in session like this in controller..
\Session::flash('flash_message', 'registration is successful.');
return redirect("/successPage");
and show error message in view like this..
{{ Session::get('flash_message')}}