Mech Mech - 2 years ago 70
PHP Question

I am using laravel 5. I am using flash messaging, it is not working

My code like below!


use Session;

public function update($id, Request $request)
$book = Section::findOrFail($id);
$input = $request->all();

$book ->fill($input)->save();

Session::flash('message', 'Book successfully updated!');
return redirect()->back();


And below is my Template file code :

<div class="alert alert-primary fade in">
<button data-dismiss="alert" class="close"><span>×</span></button>
{{ Session::get('message') }}

i am beginner for
. In controller i already use
and then using
, and in template file i get it using

Answer Source

I was able to get it working by placing the route within the "web" middleware in route file:

Route::group(['middleware' =>['web'], 'prefix' => 'admin'], function () {   
    Route::resource('book', 'BookController');

After adding middleware web it works fine!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download