验证中...
Languages: PHP
Categories: 其他
Latest update 2019-01-19 08:01
gistfile1.txt
Raw Copy
<?php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class ElasticSearch extends Facade
{
protected static function getFacadeAccessor()
{
return 'elasticsearch';
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Elasticsearch\ClientBuilder as ElasticBuilder;
class ElasticSearchServiceProvider extends ServiceProvider
{
public function boot(){
}
/**
*
*/
public function register(){
// $servers = [
// [
// "host" => "127.0.0.1",
// "port" => 9200,
// 'user' => 'elastic',
// 'pass' => 'xxhhou.'
// ],
// ];
$this->app->singleton('elasticsearch',function()use($servers){
return ElasticBuilder::create()
->setHosts($servers)
->build();
});
}
}

Comment list( 0 )

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025