diff --git a/src/DataTablesServiceProvider.php b/src/DataTablesServiceProvider.php index 98651d83..84b594a9 100644 --- a/src/DataTablesServiceProvider.php +++ b/src/DataTablesServiceProvider.php @@ -15,20 +15,6 @@ class DataTablesServiceProvider extends ServiceProvider */ protected $defer = false; - /** - * Bootstrap the application events. - * - * @return void - */ - public function boot() - { - $this->mergeConfigFrom(__DIR__ . '/config/datatables.php', 'datatables'); - - $this->publishes([ - __DIR__ . '/config/datatables.php' => config_path('datatables.php'), - ], 'datatables'); - } - /** * Register the service provider. * @@ -40,6 +26,8 @@ public function register() require_once 'lumen.php'; } + $this->setupAssets(); + $this->app->alias('datatables', DataTables::class); $this->app->singleton('datatables', function () { return new DataTables; @@ -52,6 +40,20 @@ public function register() $this->app->singleton('datatables.config', Config::class); } + /** + * Setup package assets. + * + * @return void + */ + protected function setupAssets() + { + $this->mergeConfigFrom($config = __DIR__ . '/config/datatables.php', 'datatables'); + + if ($this->app->runningInConsole()) { + $this->publishes([$config => config_path('datatables.php')], 'datatables'); + } + } + /** * Check if app uses Lumen. *