diff --git a/composer.json b/composer.json index 6b92faf..0495956 100644 --- a/composer.json +++ b/composer.json @@ -21,5 +21,12 @@ "psr-4": { "CraftCodery\\Searchable\\": "src/" } + }, + "extra": { + "laravel": { + "providers": [ + "CraftCodery\\Searchable\\SearchableServiceProvider" + ] + } } } diff --git a/src/SearchableServiceProvider.php b/src/SearchableServiceProvider.php index 4fc64fd..06b51ed 100644 --- a/src/SearchableServiceProvider.php +++ b/src/SearchableServiceProvider.php @@ -8,8 +8,20 @@ class SearchableServiceProvider extends ServiceProvider { public function boot() { - $configPath = __DIR__ . '/../config/searchable.php'; - $this->publishes([$configPath => config_path('searchable.php')]); - $this->mergeConfigFrom($configPath, 'searchable'); + if ($this->app->runningInConsole()) { + $this->publishes([ + __DIR__ . '/../config/searchable.php' => config_path('searchable.php'), + ], 'searchable-config'); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->mergeConfigFrom(__DIR__ . '/../config/searchable.php', 'searchable'); } }