diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 225aa2ab53de..4a662538f294 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -458,6 +458,22 @@ public function pingBefore($url) }); } + /** + * Register a callback to ping a given URL before the job runs if condition is true. + * + * @param bool $condition + * @param string $url + * @return $this + */ + public function pingBeforeIf(bool $condition, string $url) + { + if ($condition) { + return $this->pingBefore($url); + } + + return $this; + } + /** * Register a callback to ping a given URL after the job runs. *