Skip to content

Commit

Permalink
Revert "[11.x] Name of job set by displayName() must be honoured by S…
Browse files Browse the repository at this point in the history
…chedule …" (laravel#51034)

This reverts commit d63d2b1.
  • Loading branch information
RobertBoes authored Apr 12, 2024
1 parent c1bec87 commit d08a9b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 89 deletions.
22 changes: 9 additions & 13 deletions src/Illuminate/Console/Scheduling/Schedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,15 @@ public function command($command, array $parameters = [])
*/
public function job($job, $queue = null, $connection = null)
{
$instance = is_string($job)
? Container::getInstance()->make($job)
: $job;

$name = method_exists($instance, 'displayName')
? $instance->displayName()
: $instance::class;

return $this->call(function () use ($instance, $queue, $connection) {
$instance instanceof ShouldQueue
? $this->dispatchToQueue($instance, $queue ?? $instance->queue, $connection ?? $instance->connection)
: $this->dispatchNow($instance);
})->name($name);
return $this->call(function () use ($job, $queue, $connection) {
$job = is_string($job) ? Container::getInstance()->make($job) : $job;

if ($job instanceof ShouldQueue) {
$this->dispatchToQueue($job, $queue ?? $job->queue, $connection ?? $job->connection);
} else {
$this->dispatchNow($job);
}
})->name(is_string($job) ? $job : get_class($job));
}

/**
Expand Down
14 changes: 0 additions & 14 deletions tests/Console/Fixtures/JobToTestWithSchedule.php

This file was deleted.

62 changes: 0 additions & 62 deletions tests/Console/Scheduling/ScheduleTest.php

This file was deleted.

0 comments on commit d08a9b0

Please sign in to comment.