Add scoutserviceprovider to conditionally load
This commit is contained in:
parent
2795faa0fe
commit
03c4f62b6e
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2025. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Laravel\Scout\ScoutServiceProvider as BaseScoutServiceProvider;
|
||||||
|
|
||||||
|
class ScoutServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register services.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
// Only register Scout if driver is not null
|
||||||
|
if (config('scout.driver') !== 'null') {
|
||||||
|
$this->app->register(BaseScoutServiceProvider::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
// Scout will be booted automatically by the base provider if driver is not null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -200,6 +200,7 @@ return [
|
||||||
App\Providers\ClientPortalServiceProvider::class,
|
App\Providers\ClientPortalServiceProvider::class,
|
||||||
App\Providers\NinjaTranslationServiceProvider::class,
|
App\Providers\NinjaTranslationServiceProvider::class,
|
||||||
App\Providers\StaticServiceProvider::class,
|
App\Providers\StaticServiceProvider::class,
|
||||||
|
App\Providers\ScoutServiceProvider::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue