Skip to content

Commit

Permalink
fixed #68
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Sep 9, 2020
1 parent 9c3ece4 commit 5731c99
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,27 @@
use Akaunting\Setting\Drivers\Database;
use Akaunting\Setting\Drivers\Json;
use Akaunting\Setting\Drivers\Memory;
use Illuminate\Foundation\Application;
use Illuminate\Support\Manager as BaseManager;
use Illuminate\Support\Str;

class Manager extends BaseManager
{
/**
* Normalized Laravel Version.
* The container instance.
*
* @var string
* @var \Illuminate\Contracts\Container\Container
*/
protected $version;
protected $container;

/**
* True when this is a Lumen application.
* The application instance.
*
* @var bool
*/
protected $is_lumen = false;

/**
* @param Application $app
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct($app = null)
{
if (!$app) {
$app = app(); //Fallback when $app is not given
}

parent::__construct($app);
$this->container = $app ?? app();

$this->version = $app->version();
$this->is_lumen = Str::contains($this->version, 'Lumen');
parent::__construct($this->container);
}

public function getDefaultDriver()
Expand All @@ -49,12 +37,12 @@ public function createJsonDriver()
{
$path = config('setting.json.path');

return new Json($this->app['files'], $path);
return new Json($this->container['files'], $path);
}

public function createDatabaseDriver()
{
$connection = $this->app['db']->connection(config('setting.database.connection'));
$connection = $this->container['db']->connection(config('setting.database.connection'));
$table = config('setting.database.table');
$key = config('setting.database.key');
$value = config('setting.database.value');
Expand Down

0 comments on commit 5731c99

Please sign in to comment.