php - Laravel 5 Session not available for the second page -


i new in laravel, , using laravel 5 storing values in session this

this in controller function abc

    session::put('check_in', $check_in);     session::put('check_out', $check_out);     session::put('no_of_rooms', $no_of_rooms);     session::put('adult', $adult);     session::put('child', $child);     return view('room'); 

i getting values of these sessions in rooms view, problem when going other link or on other page room view , using session as

    echo session::get('check_in')."<br>";     echo session::get('check_out')."<br>";     echo session::get('no_of_rooms')."<br><br>";     echo session::get('adult')."<br>";     echo session::get('child')."<br>"; 

i not able of these sessions value.

i using sessions has on pages till session flashed or browser gets closed, not retrieving of session values..

i have seen may topics on stack overflow, not able understand answers, please explain me thoroughly , solve problem, stucked @ part last 4 5 days clueless.......

if using laravel 5.*, should use 'web' middleware in routes use session.

this looks this: in routes.php in app/http directory

route::group(['middleware' => 'web'], function () {     route::auth();     route::get('/', 'homecontroller@index');    route::get('/login', 'usercontroller@userloginview');    route::post('/login', 'usercontroller@userlogin'); } 

you can use session in routes declaring under 'web' middleware.

i suggest read more 'web' middleware in laravel 5.

check out: my laravel 5.2.10 sessions wont persist

note: of laravel 5.2.27 web middleware in place default, try removing route::group , see if helps. https://github.com/laravel/laravel/blob/v5.2.27/app/providers/routeserviceprovider.php#l56


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -