diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 7a16128265e5..371e2d7018d8 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -59,13 +59,6 @@ class Event */ protected $afterCallbacks = []; - /** - * The human readable description of the event. - * - * @var string|null - */ - public $description; - /** * The event mutex implementation. * @@ -730,30 +723,6 @@ protected function withOutputCallback(Closure $callback, $onlyIfOutputExists = f }; } - /** - * Set the human-friendly description of the event. - * - * @param string $description - * @return $this - */ - public function name($description) - { - return $this->description($description); - } - - /** - * Set the human-friendly description of the event. - * - * @param string $description - * @return $this - */ - public function description($description) - { - $this->description = $description; - - return $this; - } - /** * Get the summary of the event for display. * diff --git a/src/Illuminate/Console/Scheduling/ManagesAttributes.php b/src/Illuminate/Console/Scheduling/ManagesAttributes.php index 90cecc6efa9c..1a18378eb62f 100644 --- a/src/Illuminate/Console/Scheduling/ManagesAttributes.php +++ b/src/Illuminate/Console/Scheduling/ManagesAttributes.php @@ -90,6 +90,13 @@ trait ManagesAttributes */ protected $rejects = []; + /** + * The human readable description of the event. + * + * @var string|null + */ + public $description; + /** * Set which user the command should run as. * @@ -199,4 +206,28 @@ public function skip($callback) return $this; } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function name($description) + { + return $this->description($description); + } + + /** + * Set the human-friendly description of the event. + * + * @param string $description + * @return $this + */ + public function description($description) + { + $this->description = $description; + + return $this; + } } diff --git a/src/Illuminate/Console/Scheduling/PendingEventAttributes.php b/src/Illuminate/Console/Scheduling/PendingEventAttributes.php index 13f4210afb3b..5078fb952c20 100644 --- a/src/Illuminate/Console/Scheduling/PendingEventAttributes.php +++ b/src/Illuminate/Console/Scheduling/PendingEventAttributes.php @@ -42,6 +42,10 @@ public function mergeAttributes(Event $event): void $event->expression = $this->expression; $event->repeatSeconds = $this->repeatSeconds; + if ($this->description !== null) { + $event->name($this->description); + } + if ($this->timezone !== null) { $event->timezone($this->timezone); } diff --git a/src/Illuminate/Console/Scheduling/Schedule.php b/src/Illuminate/Console/Scheduling/Schedule.php index 8b2fe1bbcf9d..9a4aa74c97e9 100644 --- a/src/Illuminate/Console/Scheduling/Schedule.php +++ b/src/Illuminate/Console/Scheduling/Schedule.php @@ -184,7 +184,7 @@ public function job($job, $queue = null, $connection = null) : $job::class; } - return $this->call(function () use ($job, $queue, $connection) { + return $this->name($jobName)->call(function () use ($job, $queue, $connection) { $job = is_string($job) ? Container::getInstance()->make($job) : $job; if ($job instanceof ShouldQueue) { @@ -192,7 +192,7 @@ public function job($job, $queue = null, $connection = null) } else { $this->dispatchNow($job); } - })->name($jobName); + }); } /**