2018-08-06 12:30:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
use Solarium\Client;
|
|
|
|
|
|
|
|
class SolariumServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
protected $defer = true;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2018-11-08 16:47:27 +00:00
|
|
|
$this->app->bind(Client::class, function ($app) {
|
2018-08-06 12:30:51 +00:00
|
|
|
// $config = config('solarium');
|
|
|
|
$config = array(
|
|
|
|
'endpoint' => array(
|
|
|
|
'localhost' => array(
|
2018-11-08 16:47:27 +00:00
|
|
|
'host' => '127.0.0.1',
|
|
|
|
'port' => '8983',
|
2018-08-06 12:30:51 +00:00
|
|
|
'path' => '/solr/',
|
|
|
|
'core' => 'opus4'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
//return new Client($config);
|
|
|
|
return new Client($config);
|
|
|
|
//return new Client($app['config']['solarium']);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function provides()
|
|
|
|
{
|
|
|
|
return [Client::class];
|
|
|
|
}
|
|
|
|
}
|