I think that problem is because flash message is only for the next request.
I'm using "message" instead:
controller:
return Redirect::to('/login')->with('message', 'error!')->withInput();
view:
<strong>{{ Session::get('message') }}</strong>
I know it's only for the next request but when in a controller I use
return Redirect::to("user")->with('flash_notice', 'Account created');
it works.
I've tried as you suggested but it's still not working. I've changed App:error to return
return Redirect::to("main")->with("message", $msg);
and logged Session::all() in the route but the message value is not there.
I don't know if the App:error handler is doing something different than a normal controller action.
I had some issues with Session variables when I was using latest dev version of debugbar https://github.com/barryvdh/laravel-debugbar Maybe that's the reason ?
It works for me:
App::error(function(Exception $exception, $code)
{
Log::error($exception);
Session::flash('message', 'ERROR! ' . $exception->getMessage());
return Redirect::to('/error');
// return Redirect::to('/error')->with('message', $exception->getMessage()); Also works
});
$router->get('error', function(){
return print_r(Session::all(), true);
});
EDIT: Session configuration? Have you tried storing stuff on the session outside of the error case?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community