Support the ongoing development of Laravel.io →
Configuration Session Database
Last updated 2 years ago.
0

Did you specify connection value from config/session.php file?

When using the "database" or "redis" session drivers, you may specify a connection that should be used to manage these sessions. This should correspond to a connection in your database configuration options.

0

This line:

'driver' => env('SESSION_DRIVER', 'database'),

only sets driver to database if SESSION_DRIVER environment variable is not defined... and it probably is, in your .env file.

Last updated 9 years ago.
0

From config/session.php

	/*
	|--------------------------------------------------------------------------
	| Session Database Connection
	|--------------------------------------------------------------------------
	|
	| When using the "database" or "redis" session drivers, you may specify a
	| connection that should be used to manage these sessions. This should
	| correspond to a connection in your database configuration options.
	|
	*/

	'connection' => null,
0

Thanks, that solved the problem.

Another question. What is best practice working with .env vs config files? Should I have both and only store sensitive info in the .env?

0

In config files I store only static values that applies to all of my environments. In .env files only values that related to specific environment.

I don't say that this is the best practice, but this is the way I am doing it.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

jake142 jake142 Joined 14 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.