Laravel - Session returns null

session()->forget laravel
laravel check if session exists
laravel login session example
check session in laravel blade
laravel session example
laravel get all session data
custom session laravel
laravel session domain

I'm using sessions for the first time in Laravel and I'm trying to do a multiple step form, so I thought using sessions would be a smart move. however the following code returns a null value, what am I doing wrong?

        $user_information = [
            "name"           => $request->name,
            "email"          => $request->email,
            "remember_token" => $request->_token,
            "password"       => bcrypt($request->password),
            "role_id"        => 3

        session('user_signup', $user_information);


In your controller you can save variable into session like


For checking your session variable in controller

session()->has('user_signup','default value');

For deleting your session variable in controller


For checking your session variable if it exists in blade and printing it out


Laravel session helper always returning null for first time on page, I am using Session via File driver in Laravel 5.5. The issue is that on every page request I check if session key "paramount" is set or  I saw this questions: Laravel 5 - session put not working Laravel session key is null after put in session laravel session returning null inspite of setting it Laravel 5 - session doesn't work Trying to modify my code but nothing changed.

Try this

  session(['user_signup'=> $user_information]);



and you can check session by logging it


check your log file it should be there.

Laravel docs link -

Content of a session always return null, This code $old = session('compare') ? session('compare') : null; is supposed to return the On second request, retrieve that session value, which is known to be NULL (and is shown as NULL in Laravel DebugBar's session tab), with a default: dd(session()->pull('session_uri', '/')); // outputs 'null' trip-somers commented Oct 25, 2016 trip-somers commented Oct 25, 2016 •

first : you put something in a session second : check the storage/framework/session folder , if your session work fine you can see your session data in a session folder now

if you save a session and session folder is still empty :

first change the 'driver' => env('SESSION_DRIVER', 'file') to 'driver' => env('SESSION_DRIVER', 'array') and 'driver' => env('SESSION_DRIVER', 'database')

second set the storage/framework/session permission to 755

and finaly go to your kernal file and add bellow code in 'api'

  'api' => [

            //add this bellow two line 



then check your session folder again and if you put something in any session you should now see them in this folder, you can delete files in session folder, use the session again to save something in it , going back to session folder and see the session folder is not empty anymore , and you're done, image of the session folder

Session - Laravel, The session configuration file is stored at config/session.php . Be sure to review the well documented options available to you in this file. By default, Laravel is  It returns a value of NULL. laravel find returning null when trying to do an update. 1. Laravel 5.1 find eloquent returns null. 0. TCPDF get value from database. 0.

HTTP Session - Laravel, To determine if an item is present in the session, even if its value is null , you may use the exists method. The exists method returns true if the item is present: To determine if an item is present in the session, even if its value is null, you may use the exists method. The exists method returns true if the item is present: if ($request->session()->exists('users')) { // }

BUG? session()->pull() returning NULL instead of default value , By default, Laravel is configured to use the file session driver, which will work well for the majority of applications. Before using Redis sessions with Laravel, you  Laravel also provides a mechanism for invalidating and "logging out" a user's sessions that are active on other devices without invalidating the session on their current device. This feature is typically utilized when a user is changing or updating their password and you would like to invalidate sessions on other devices while keeping the

Laravel - Session returns null, Laravel Version: 5.1.45 PHP Version: 5.6.26 Database Driver & Version: PostgreSQL 9.3.2 Description: As the subject line says, I was  By default, Laravel includes the TrimStrings and ConvertEmptyStringsToNull middleware in your application's global middleware stack. These middleware are listed in the stack by the App\Http\Kernel class. These middleware will automatically trim all incoming string fields on the request, as well as convert any empty string fields to null. This

  • what Laravel version are you using and where do you store your sessions?
  • I guess i'm using the latest version, I didn't tweak my setting so it should be on the "file" driver
  • Getting a session item is with session(key, default) setting a session is with session([key => value])
  • @apokryfos it worked, such a rookie mistake. Thank you very much
  • Thanks. how to get name of user_signup session or every session?
  • whats the difference between session push and put? will try your solution