Skip to content

Commit

Permalink
Merge pull request #80 from rick20/master
Browse files Browse the repository at this point in the history
Bindings should be placed in register()
  • Loading branch information
denisdulici authored Feb 12, 2021
2 parents 7ac79e8 + e48ef08 commit 1e7d9c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class MyDriver extends Akaunting\Setting\Contracts\Driver
// ...
}

setting()->extend('mydriver', function($app) {
app('setting.manager')->extend('mydriver', function($app) {
return $app->make('MyDriver');
});
```
Expand Down
16 changes: 8 additions & 8 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ public function boot()
__DIR__ . '/Migrations/2017_08_24_000000_create_settings_table.php' => database_path('migrations/2017_08_24_000000_create_settings_table.php'),
], 'setting');

$this->app->singleton('setting.manager', function ($app) {
return new Manager($app);
});

$this->app->singleton('setting', function ($app) {
return $app['setting.manager']->driver();
});

// Auto save setting
if (config('setting.auto_save')) {
$kernel = $this->app['Illuminate\Contracts\Http\Kernel'];
Expand All @@ -50,6 +42,14 @@ public function boot()
*/
public function register()
{
$this->app->singleton('setting.manager', function ($app) {
return new Manager($app);
});

$this->app->singleton('setting', function ($app) {
return $app['setting.manager']->driver();
});

$this->mergeConfigFrom(__DIR__ . '/Config/setting.php', 'setting');
}

Expand Down

0 comments on commit 1e7d9c9

Please sign in to comment.