Add scoutserviceprovider to conditionally load

This commit is contained in:
David Bomba 2025-09-01 21:18:49 +10:00
parent 2795faa0fe
commit 03c4f62b6e
2 changed files with 39 additions and 0 deletions

View File

@ -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
}
}

View File

@ -200,6 +200,7 @@ return [
App\Providers\ClientPortalServiceProvider::class,
App\Providers\NinjaTranslationServiceProvider::class,
App\Providers\StaticServiceProvider::class,
App\Providers\ScoutServiceProvider::class,
],
/*