Support the ongoing development of Laravel.io →
posted 10 years ago
Session
Last updated 2 years ago.
0

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>

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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 ?

Last updated 2 years ago.
0

No I don't use debugbar in my project.

Last updated 2 years ago.
0

Nobody has idea on how do that?

Last updated 2 years ago.
0

I'm having the same issue, @thagul do you have something figured out?

Last updated 2 years ago.
0

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?

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

thagul thagul Joined 1 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.