Skip to content

Commit

Permalink
fix: tap method does not exist in < Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphjsmit committed Oct 24, 2024
1 parent dd1c2c8 commit 69e7ab8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Supervisor/SupervisorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace RalphJSmit\LaravelHorizonCron\Supervisor;

use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\ServiceProvider;

Expand All @@ -20,12 +19,13 @@ public function boot(): void

$this->app->booted(function () {
if (config('horizon-cron-supervisor.enabled')) {
$expression = config('horizon-cron-supervisor.schedule');
$schedule = $this->app->make(Schedule::class);

$schedule->command('supervisor:check')->tap(
fn (Event $event) => $event->expression = is_numeric($expression) ? "*/{$expression} * * * *" : $expression
);
$expression = config('horizon-cron-supervisor.schedule');

$schedule
->command('supervisor:check')
->cron(is_numeric($expression) ? "*/{$expression} * * * *" : $expression);
}
});
}
Expand Down

0 comments on commit 69e7ab8

Please sign in to comment.