Session variable is not clearing in Laravel using Route Redirect with -


i'm using laravel 5.1 , zizaco/entrust roles & permissions. here i'v issue while clearing session variable. per understanding with() method – purpose add error message or input data particular redirect , 1 page. in case redirecting dashboard session message existing after refreshing page.

route

<?php   route::group(['middleware' => 'auth'], function ()    {          route::get('dashboard', function () {            return view('dashboard');         });        entrust::routeneedspermission('add_item', 'create_item', redirect::to('dashboard/')->with('message', 'you dont have peremissions..'), false );        route::get('add_item', 'itemcontroller@create');   }); 

view

@if(session::has('message'))    <p class="alert {{ session::get('alert-class', 'alert-info') }}">{{     session::get('message') }}</p>   {{session::forget('message')}} @endif 

i tried dumping session refreshing page. have no idea why 'message' still existing in session data. me figure out issue

data stored in session using with() (flash data) available on next http request , deleted. meaning don't have add {{session::forget('message')}} code.

entrust package uses route::filter (in routeneedspermission , other functions) deprecated of laravel 5.1.

may redirect not processed way meant be.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -