Create a Migration to Store Sessions in The Database

If you want to use the database to store the sessions, then you will need a special table for this.

Just as you'd expect, Laravel can take care of this through Artisan, as it has a special option to create a migration with everything you need for you.

How to create a migration for sessions

In order to create the migration you have to run the following command:

php artisan session:table

Fortunately you don't even have to touch the migration, as it already contains everything you need. The only thing you have to do now is to run the migration.

php artisan migrate

Now you have the table where Laravel can store the sessions. You will have to head over to app/config/session.php and change the driver to database.