@@ -23,15 +23,15 @@ public function createJsonDriver()
2323 {
2424 $ path = $ this ->getConfig ('anlutro/l4-settings::path ' );
2525
26- $ store = new JsonSettingStore ($ this ->app ['files ' ], $ path );
26+ $ store = new JsonSettingStore ($ this ->getSupportedContainer () ['files ' ], $ path );
2727
2828 return $ this ->wrapDriver ($ store );
2929 }
3030
3131 public function createDatabaseDriver ()
3232 {
3333 $ connectionName = $ this ->getConfig ('anlutro/l4-settings::connection ' );
34- $ connection = $ this ->app ['db ' ]->connection ($ connectionName );
34+ $ connection = $ this ->getSupportedContainer () ['db ' ]->connection ($ connectionName );
3535 $ table = $ this ->getConfig ('anlutro/l4-settings::table ' );
3636 $ keyColumn = $ this ->getConfig ('anlutro/l4-settings::keyColumn ' );
3737 $ valueColumn = $ this ->getConfig ('anlutro/l4-settings::valueColumn ' );
@@ -57,7 +57,7 @@ protected function getConfig($key)
5757 $ key = str_replace ('anlutro/l4-settings:: ' , 'settings. ' , $ key );
5858 }
5959
60- return $ this ->app ['config ' ]->get ($ key );
60+ return $ this ->getSupportedContainer () ['config ' ]->get ($ key );
6161 }
6262
6363 protected function wrapDriver ($ store )
@@ -66,12 +66,17 @@ protected function wrapDriver($store)
6666
6767 if ($ this ->getConfig ('anlutro/l4-settings::enableCache ' )) {
6868 $ store ->setCache (
69- $ this ->app ['cache ' ],
69+ $ this ->getSupportedContainer () ['cache ' ],
7070 $ this ->getConfig ('anlutro/l4-settings::cacheTtl ' ),
7171 $ this ->getConfig ('anlutro/l4-settings::forgetCacheByWrite ' )
7272 );
7373 }
7474
7575 return $ store ;
7676 }
77+
78+ protected function getSupportedContainer ()
79+ {
80+ return isset ($ this ->app ) ? $ this ->app : $ this ->container ;
81+ }
7782}
0 commit comments