From 9caf630632bb767c975f0787b9e7b1b90cb87b72 Mon Sep 17 00:00:00 2001 From: Aaron Huisinga Date: Wed, 28 Apr 2021 14:57:06 -0500 Subject: [PATCH] Bug fixes --- composer.json | 7 +++++++ src/SearchableServiceProvider.php | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) 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'); } }