Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

swamydeshetty's avatar

Session storing and retreiving

i have stored the session something like this in my AttendanceController attendance function $message ='Upload in Progress'; $val4 =3436; $count = count($data);

session(['selectedRecordData' => compact('val4', 'count','message')]);

When i try to retrieve it in my Rfid vehicle controller vehiclelistcreate function like this $selectedRecordData = session('selectedRecordData'); dd(session('selectedRecordData'));

im getting null why what is the issue here!..

0 likes
6 replies
Snapey's avatar

use session()->put()

Also beware using dd() session data will not be saved if you die and dump after saving data

swamydeshetty's avatar

@Snapey just checking session is accessing or not using dd for debugging purpose i used the dd

swamydeshetty's avatar

@Snapey still it is not working man i dont know where is the issue im getting but another controller is not accepting the session whatever i have stored in the attendance controller

Snapey's avatar

@swamydeshetty use laravel debugbar to show what is in session.

use session()->put() method to save data in session

swamydeshetty's avatar

@Snapey $upload = 'Upload in Progress'; \Log::info('Storing data in session:', compact('val4', 'count', 'upload'));

                                    // Store data in the session
                                    session()->put('StoreData', compact('val4', 'count', 'upload'));

                                    \Log::info('Data stored in session:', session()->get('StoreData')); used  put method  but it is not receiving the data from the controller!..
Snapey's avatar

use laravel debugbar to show what is in session.

Please or to participate in this conversation.