Nav apraksta

EsServiceProvider.php 697B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Providers;
  3. use App\Components\EsNative;
  4. use Illuminate\Support\ServiceProvider;
  5. class EsServiceProvider extends ServiceProvider
  6. {
  7. /**
  8. * Indicates if loading of the provider is deferred.
  9. *
  10. * @var bool
  11. */
  12. protected $defer = true;
  13. /**
  14. * Register the service provider.
  15. *
  16. * @return void
  17. */
  18. public function register()
  19. {
  20. $this->app->singleton('es', function ($app) {
  21. return new EsNative($app['config']['database.es']);
  22. });
  23. }
  24. /**
  25. * Get the services provided by the provider.
  26. *
  27. * @return array
  28. */
  29. public function provides()
  30. {
  31. return ['es'];
  32. }
  33. }