php - Laravel 5.2 - Session::get not working -


i want display 'falsh-message' user start redirect him in routes.php following code :

route::get('/alert',function () {     return redirect()->route('home')->with('message', 'this test message!'); }); 

in alerts.blade.php include in home view read message with:

route::group(['middleware' => ['web']], function () {   route::get('/alert',function () {         return redirect()->route('home')->with('message', 'this test message!');     }); }); 

my session set under storage\framework\sessions following code :

a:5:{s:6:"_token";s:40:"8304u3fjr9ehva88qmvgqngcgducwozj9lrhadph";s:7:"message";s:23:"this test message!";s:5:"flash";a:2:{s:3:"new";a:0:{}s:3:"old";a:1:{i:0;s:7:"message";}}s:9:"_previous";a:1:{s:3:"url";s:22:"http://localhost/alert";}s:9:"_sf2_meta";a:3:{s:1:"u";i:1452937821;s:1:"c";i:1452937821;s:1:"l";s:1:"0";}} 

but problem laravel gives me no output message because empty. maybe can me.

routes.php :

route::group(['middleware' => ['web']], function () {     route::get('/', [         'uses' => '\app\http\controllers\homecontroller@index',         'as' => 'home',     ]);     route::get('/alert',function () {         return redirect()->route('home')->with('message', 'this test message!');     }); }); 

insert session flash data explicitly..

route::get('/alert',function () {     $request->session()->flash('message', 'task successful!');     return redirect()->route('home'); }); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -