JasonGenX
JasonGenX

Reputation: 5434

Laravel 5: how do I tell Sessions.php to use my .env database connection?

I'd like sessions to be saved to database.

in Sessions.php I specified:

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

The connection section is null though by default...

'connection' => null,

I'd like for it to use the information in my .env file to gain database connection. How do I do that?

The reason I'm asking is because with that connection as 'null' - it doesn't write anything to my database (and other parts of my app do, so I know the database connection is ok). I created the sessions table as the documentation says - but still nothing is ever written there.

Upvotes: 0

Views: 1336

Answers (1)

JasonGenX
JasonGenX

Reputation: 5434

i figured it out. My .env file had SESSION_DRIVER as file. Somehow I missed that. Changing it to database resolved this and now the sessions are written to my database correctly.

Upvotes: 1

Related Questions