I want to display an 'falsh-message' for the user I start to redirect him in the routes.php
with following code :
Route::get('/alert',function () {
return redirect()->route('home')->with('message', 'This is a Test Message!');
});
In the alerts.blade.php
that I include in the home view I would like to read this message with:
Route::group(['middleware' => ['web']], function () {
Route::get('/alert',function () {
return redirect()->route('home')->with('message', 'This is a Test Message!');
});
});
My Session would be set under storage\framework\sessions
with the following code :
a:5:{s:6:"_token";s:40:"8304u3fjR9EhvA88QMVGQnGcgdUcWoZj9LrHaDPh";s:7:"message";s:23:"This is a 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 the Problem is that Laravel gives me no output from the message because it is empty. So maybe someone can help 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 is a Test Message!');
});
});