@@ -23,15 +23,15 @@ public function createJsonDriver()
23
23
{
24
24
$ path = $ this ->getConfig ('anlutro/l4-settings::path ' );
25
25
26
- $ store = new JsonSettingStore ($ this ->app ['files ' ], $ path );
26
+ $ store = new JsonSettingStore ($ this ->getSupportedContainer () ['files ' ], $ path );
27
27
28
28
return $ this ->wrapDriver ($ store );
29
29
}
30
30
31
31
public function createDatabaseDriver ()
32
32
{
33
33
$ connectionName = $ this ->getConfig ('anlutro/l4-settings::connection ' );
34
- $ connection = $ this ->app ['db ' ]->connection ($ connectionName );
34
+ $ connection = $ this ->getSupportedContainer () ['db ' ]->connection ($ connectionName );
35
35
$ table = $ this ->getConfig ('anlutro/l4-settings::table ' );
36
36
$ keyColumn = $ this ->getConfig ('anlutro/l4-settings::keyColumn ' );
37
37
$ valueColumn = $ this ->getConfig ('anlutro/l4-settings::valueColumn ' );
@@ -57,7 +57,7 @@ protected function getConfig($key)
57
57
$ key = str_replace ('anlutro/l4-settings:: ' , 'settings. ' , $ key );
58
58
}
59
59
60
- return $ this ->app ['config ' ]->get ($ key );
60
+ return $ this ->getSupportedContainer () ['config ' ]->get ($ key );
61
61
}
62
62
63
63
protected function wrapDriver ($ store )
@@ -66,12 +66,17 @@ protected function wrapDriver($store)
66
66
67
67
if ($ this ->getConfig ('anlutro/l4-settings::enableCache ' )) {
68
68
$ store ->setCache (
69
- $ this ->app ['cache ' ],
69
+ $ this ->getSupportedContainer () ['cache ' ],
70
70
$ this ->getConfig ('anlutro/l4-settings::cacheTtl ' ),
71
71
$ this ->getConfig ('anlutro/l4-settings::forgetCacheByWrite ' )
72
72
);
73
73
}
74
74
75
75
return $ store ;
76
76
}
77
+
78
+ protected function getSupportedContainer ()
79
+ {
80
+ return isset ($ this ->app ) ? $ this ->app : $ this ->container ;
81
+ }
77
82
}
0 commit comments