From bae1b4d0233e9be78f45df985c0bb6f0bfec6c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Wed, 30 Oct 2024 15:00:40 +0000 Subject: [PATCH] fix --- app/Providers/AppServiceProvider.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 43c2db7..6c8ebf8 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,6 +7,7 @@ use App\Models\ScheduledJob; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\QueryException; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Str; @@ -65,16 +66,20 @@ protected function setSeoDefaults(): void protected function resolveSchedule(): void { $this->app->resolving(Schedule::class, function (Schedule $schedule) { - ScheduledJob::query() - ->with('election') - ->where('is_enabled', true) - ->each( - fn (ScheduledJob $job) => $schedule - ->job(new $job->job($job)) - ->cron($job->cron->value) - ->withoutOverlapping() - ->onOneServer() - ); + try { + ScheduledJob::query() + ->with('election') + ->where('is_enabled', true) + ->each( + fn (ScheduledJob $job) => $schedule + ->job(new $job->job($job)) + ->cron($job->cron->value) + ->withoutOverlapping() + ->onOneServer() + ); + } catch (QueryException $th) { + // fix for composer install + } }); } }