diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index da41361a6bc3..225aa2ab53de 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -471,6 +471,22 @@ public function thenPing($url) }); } + /** + * Register a callback to ping a given URL after the job runs if condition is true. + * + * @param bool $condition + * @param string $url + * @return $this + */ + public function thenPingIf(bool $condition, string $url) + { + if ($condition) { + return $this->thenPing($url); + } + + return $this; + } + /** * State that the command should run in background. *