Skip to content

Commit

Permalink
Support Laravel >= 8
Browse files Browse the repository at this point in the history
  • Loading branch information
abdrzakoxa committed Sep 9, 2020
1 parent 44c1c9c commit 94da780
Showing 1 changed file with 9 additions and 4 deletions.
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 94da780

Please sign in to comment.