From 2a111ec98cbf3c03673935cb568e98c4e4e80562 Mon Sep 17 00:00:00 2001 From: Propaganistas Date: Fri, 13 Dec 2024 18:42:02 +0100 Subject: [PATCH] don't write to horizon config when not available --- src/ScheduleMonitorServiceProvider.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ScheduleMonitorServiceProvider.php b/src/ScheduleMonitorServiceProvider.php index 8da0cd4..29fa3a1 100644 --- a/src/ScheduleMonitorServiceProvider.php +++ b/src/ScheduleMonitorServiceProvider.php @@ -5,6 +5,7 @@ use Illuminate\Console\Events\CommandStarting; use Illuminate\Console\Scheduling\Event as SchedulerEvent; use Illuminate\Support\Facades\Event; +use Laravel\Horizon\Horizon; use OhDear\PhpSdk\OhDear; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; @@ -88,6 +89,10 @@ protected function silenceOhDearJob(): self return $this; } + if (! class_exists(Horizon::class)) { + return $this; + } + $silencedJobs = config('horizon.silenced', []); if (in_array(PingOhDearJob::class, $silencedJobs)) {