when(function () use ($command, $frequency, $args) { $event = CronEvent::command($command); if ($frequency !== null) { $event = $event->{$frequency}(...$args); } return $event->isDue(); }); } }