From dbf4abedbb1e8e2c8ff702a6805bcfd3521fee10 Mon Sep 17 00:00:00 2001 From: basemkhirat Date: Sat, 18 Feb 2017 16:02:03 +0200 Subject: [PATCH] lumen auto configuration --- readme.md | 4 ---- src/ElasticsearchServiceProvider.php | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index e1f4e5f..e988b31 100755 --- a/readme.md +++ b/readme.md @@ -67,10 +67,6 @@ ##### 3) Copy package config directory `vendor/basemkhirat/elasticsearch/src/config` to root folder alongside with `app` directory. -##### 4) Making Lumen read our configuration files by adding these lines in `bootstrap/app.php` before returning Lumen `$app` instance. - - $app->configure("es"); - $app->configure("scout"); ##### 5) Making Lumen work with facades by uncommenting this line in `bootstrap/app.php`. diff --git a/src/ElasticsearchServiceProvider.php b/src/ElasticsearchServiceProvider.php index 444cd1e..4287a23 100755 --- a/src/ElasticsearchServiceProvider.php +++ b/src/ElasticsearchServiceProvider.php @@ -31,6 +31,11 @@ public function boot() $this->path . '/config/' => config_path(), ], "es.config"); + // Auto configuration with lumen framework. + + if (str_contains($this->app->version(), 'Lumen')) { + $this->app->configure("es"); + } // Resolve Laravel Scout engine.