diff --git a/CHANGELOG.md b/CHANGELOG.md index ac9e567..5479136 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. ## [0.8.2] - 2017-02-19 -### Added +### Fixed - fix pagination for non-laravel apps. ## [0.8.1] - 2017-02-18 @@ -23,7 +23,7 @@ All notable changes to this project will be documented in this file. ## [0.7.5] - 2017-02-17 -### fixed +### Fixed - fix query caching for lumen. ## [0.7.4] - 2017-02-17 diff --git a/LICENSE b/LICENSE index bf55ad6..0adaa0d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright 2016 +Copyright 2017 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/ElasticsearchServiceProvider.php b/src/ElasticsearchServiceProvider.php index 4287a23..686e022 100755 --- a/src/ElasticsearchServiceProvider.php +++ b/src/ElasticsearchServiceProvider.php @@ -3,6 +3,7 @@ namespace Basemkhirat\Elasticsearch; use Elasticsearch\ClientBuilder as ElasticBuilder; +use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Support\ServiceProvider; use Laravel\Scout\EngineManager; @@ -39,18 +40,27 @@ public function boot() // Resolve Laravel Scout engine. - if(class_exists("Laravel\\Scout\\EngineManager")) { + if (class_exists("Laravel\\Scout\\EngineManager")) { - $this->app->make(EngineManager::class)->extend('es', function () { + try { - $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"] + ); + + }); + + } catch (BindingResolutionException $e) { + + // Class is not resolved. + // Laravel Scout service provider was not loaded yet. + + } }