for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: arun
* Date: 2019-07-07
* Time: 13:00
*/
namespace ArunFung\ScoutElasticSearch;
use ArunFung\ScoutElasticSearch\Console\Commands\CreateElasticSearchIndex;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
use Laravel\Scout\EngineManager;
use Elasticsearch\ClientBuilder as ElasticSearchBuilder;
* Class ElasticSearchServiceProvider
* @package ArunFung\ScoutElasticSearch
class ElasticSearchServiceProvider extends ServiceProvider
{
* Register services.
*
* @return void
public function register()
$this->mergeConfigFrom(
__DIR__ . '/config/elasticsearch.php', 'elasticsearch'
);
}
* Bootstrap services.
public function boot()
$this->publishes([
__DIR__ . '/config/elasticsearch.php' => config_path('elasticsearch.php'),
config_path
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
__DIR__ . '/config/elasticsearch.php' => /** @scrutinizer ignore-call */ config_path('elasticsearch.php'),
]);
resolve(EngineManager::class)->extend('elasticsearch', function () {
resolve
/** @scrutinizer ignore-call */
return new ElasticSearchEngine(
ElasticSearchBuilder::create()->setHosts(Config::get('elasticsearch.hosts'))->build(),
Config::get('elasticsearch.index')
});
if ($this->app->runningInConsole()) {
$this->commands([
CreateElasticSearchIndex::class,