From d52175c013035286bb4fd2900e81fae325d8813e Mon Sep 17 00:00:00 2001 From: basemkhirat Date: Sat, 18 Feb 2017 14:35:38 +0200 Subject: [PATCH] remove scout service provider --- composer.json | 1 - src/ElasticsearchServiceProvider.php | 23 ++++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 388704e..566bf1e 100755 --- a/composer.json +++ b/composer.json @@ -35,7 +35,6 @@ }, "require-dev": { - "laravel/scout": "*", "phpunit/phpunit": "*" } diff --git a/src/ElasticsearchServiceProvider.php b/src/ElasticsearchServiceProvider.php index 2855b2f..444cd1e 100755 --- a/src/ElasticsearchServiceProvider.php +++ b/src/ElasticsearchServiceProvider.php @@ -34,16 +34,20 @@ public function boot() // Resolve Laravel Scout engine. - $this->app->make(EngineManager::class)->extend('es', function () { + if(class_exists("Laravel\\Scout\\EngineManager")) { - $config = config('es.connections.' . config('scout.es.connection')); + $this->app->make(EngineManager::class)->extend('es', function () { - return new ScoutEngine( - ElasticBuilder::create()->setHosts($config["servers"])->build(), - $config["index"] - ); + $config = config('es.connections.' . config('scout.es.connection')); - }); + return new ScoutEngine( + ElasticBuilder::create()->setHosts($config["servers"])->build(), + $config["index"] + ); + + }); + + } } @@ -56,12 +60,9 @@ public function boot() public function register() { - // Register laravel scout service provider. - - $this->app->register("Laravel\\Scout\\ScoutServiceProvider"); - $this->app->bind('es', function () { return new Connection(); }); + } }