Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 839df24

Browse files
koprinskiBorislav Koprinski
andauthored
Skip loading mongo session driver when mongo is not defined (#8)
Co-authored-by: Borislav Koprinski <b.koprinski@1forfit.com>
1 parent 89764df commit 839df24

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "1ff/laravel-mongodb-session",
33
"description": "A mongodb session driver for laravel",
44
"type": "library",
5-
"version": "3.0.0",
5+
"version": "3.0.1",
66
"require": {
77
"jenssegers/mongodb": "~3.8",
88
"illuminate/session": "^8.0"

src/SessionServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99

1010
class SessionServiceProvider extends ParentServiceProvider
1111
{
12-
1312
/**
1413
* Register any application services.
1514
*
1615
* @throws \Exception
1716
* @return void
18-
*
1917
*/
2018
public function boot()
2119
{
20+
if (config('session.default') !== 'mongodb') {
21+
return;
22+
}
23+
2224
Session::extend('mongodb', function ($app) {
2325
$configs = $app['config']->get('session');
2426
$connection = $app['db']->connection($configs['connection'] ?? null);

0 commit comments

Comments
 (0)