1 | <?php |
||||||
2 | /** |
||||||
3 | * Created by PhpStorm. |
||||||
4 | * User: arun |
||||||
5 | * Date: 2019-07-07 |
||||||
6 | * Time: 13:00 |
||||||
7 | */ |
||||||
8 | |||||||
9 | namespace ArunFung\ScoutElasticSearch; |
||||||
10 | |||||||
11 | use ArunFung\ScoutElasticSearch\Console\Commands\CreateElasticSearchIndex; |
||||||
12 | use Illuminate\Support\Facades\Config; |
||||||
13 | use Illuminate\Support\ServiceProvider; |
||||||
14 | use Laravel\Scout\EngineManager; |
||||||
15 | use Elasticsearch\ClientBuilder as ElasticSearchBuilder; |
||||||
16 | |||||||
17 | /** |
||||||
18 | * Class ElasticSearchServiceProvider |
||||||
19 | * @package ArunFung\ScoutElasticSearch |
||||||
20 | */ |
||||||
21 | class ElasticSearchServiceProvider extends ServiceProvider |
||||||
22 | { |
||||||
23 | /** |
||||||
24 | * Register services. |
||||||
25 | * |
||||||
26 | * @return void |
||||||
27 | */ |
||||||
28 | public function register() |
||||||
29 | { |
||||||
30 | $this->mergeConfigFrom( |
||||||
31 | __DIR__ . '/config/elasticsearch.php', 'elasticsearch' |
||||||
32 | ); |
||||||
33 | } |
||||||
34 | |||||||
35 | /** |
||||||
36 | * Bootstrap services. |
||||||
37 | * |
||||||
38 | * @return void |
||||||
39 | */ |
||||||
40 | public function boot() |
||||||
41 | { |
||||||
42 | $this->publishes([ |
||||||
43 | __DIR__ . '/config/elasticsearch.php' => config_path('elasticsearch.php'), |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
44 | ]); |
||||||
45 | |||||||
46 | resolve(EngineManager::class)->extend('elasticsearch', function () { |
||||||
0 ignored issues
–
show
The function
resolve was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
47 | return new ElasticSearchEngine( |
||||||
48 | ElasticSearchBuilder::create()->setHosts(Config::get('elasticsearch.hosts'))->build(), |
||||||
49 | Config::get('elasticsearch.index') |
||||||
50 | ); |
||||||
51 | }); |
||||||
52 | |||||||
53 | if ($this->app->runningInConsole()) { |
||||||
54 | $this->commands([ |
||||||
55 | CreateElasticSearchIndex::class, |
||||||
56 | ]); |
||||||
57 | } |
||||||
58 | } |
||||||
59 | } |
||||||
60 |