Skip to content

Commit 179b271

Browse files
authoredSep 9, 2020
Merge pull request #145 from abderrazzak-oxa/support-laravel-8
2 parents c76df67 + 94da780 commit 179b271

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed
 

‎composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
],
1111
"require": {
1212
"php": ">=5.4.0",
13-
"illuminate/support": ">=4.2 <8.0",
14-
"illuminate/cache": ">=4.2 <8.0"
13+
"illuminate/support": ">=4.2 <9.0",
14+
"illuminate/cache": ">=4.2 <9.0"
1515
},
1616
"suggest": {
1717
"illuminate/filesystem": "Save settings to a JSON file.",

‎src/SettingsManager.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
Please sign in to comment.