Skip to content

Commit

Permalink
Merge pull request #145 from abderrazzak-oxa/support-laravel-8
Browse files Browse the repository at this point in the history
  • Loading branch information
bweston92 committed Sep 9, 2020
2 parents c76df67 + 94da780 commit 179b271
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
],
"require": {
"php": ">=5.4.0",
"illuminate/support": ">=4.2 <8.0",
"illuminate/cache": ">=4.2 <8.0"
"illuminate/support": ">=4.2 <9.0",
"illuminate/cache": ">=4.2 <9.0"
},
"suggest": {
"illuminate/filesystem": "Save settings to a JSON file.",
Expand Down
13 changes: 9 additions & 4 deletions src/SettingsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public function createJsonDriver()
{
$path = $this->getConfig('anlutro/l4-settings::path');

$store = new JsonSettingStore($this->app['files'], $path);
$store = new JsonSettingStore($this->getSupportedContainer()['files'], $path);

return $this->wrapDriver($store);
}

public function createDatabaseDriver()
{
$connectionName = $this->getConfig('anlutro/l4-settings::connection');
$connection = $this->app['db']->connection($connectionName);
$connection = $this->getSupportedContainer()['db']->connection($connectionName);
$table = $this->getConfig('anlutro/l4-settings::table');
$keyColumn = $this->getConfig('anlutro/l4-settings::keyColumn');
$valueColumn = $this->getConfig('anlutro/l4-settings::valueColumn');
Expand All @@ -57,7 +57,7 @@ protected function getConfig($key)
$key = str_replace('anlutro/l4-settings::', 'settings.', $key);
}

return $this->app['config']->get($key);
return $this->getSupportedContainer()['config']->get($key);
}

protected function wrapDriver($store)
Expand All @@ -66,12 +66,17 @@ protected function wrapDriver($store)

if ($this->getConfig('anlutro/l4-settings::enableCache')) {
$store->setCache(
$this->app['cache'],
$this->getSupportedContainer()['cache'],
$this->getConfig('anlutro/l4-settings::cacheTtl'),
$this->getConfig('anlutro/l4-settings::forgetCacheByWrite')
);
}

return $store;
}

protected function getSupportedContainer()
{
return isset($this->app) ? $this->app : $this->container;
}
}

0 comments on commit 179b271

Please sign in to comment.