Skip to content

Commit

Permalink
Clean up display name, support mail and notifications and broadcasts.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 7, 2017
1 parent 4e85a9a commit d033626
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/Illuminate/Broadcasting/BroadcastEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,14 @@ protected function formatProperty($value)

return $value;
}

/**
* Get the display name for the queued job.
*
* @return string
*/
public function displayName()
{
return get_class($this->event);
}
}
10 changes: 10 additions & 0 deletions src/Illuminate/Events/CallQueuedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,14 @@ public function failed($e)
call_user_func_array([$handler, 'failed'], $parameters);
}
}

/**
* Get the display name for the queued job.
*
* @return string
*/
public function displayName()
{
return $this->class;
}
}
10 changes: 10 additions & 0 deletions src/Illuminate/Mail/SendQueuedMailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,14 @@ public function handle(MailerContract $mailer)
{
$mailer->send($this->mailable);
}

/**
* Get the display name for the queued job.
*
* @return string
*/
public function displayName()
{
return get_class($this->mailable);
}
}
10 changes: 10 additions & 0 deletions src/Illuminate/Notifications/SendQueuedNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ public function handle(ChannelManager $manager)
{
$manager->sendNow($this->notifiables, $this->notification, $this->channels);
}

/**
* Get the display name for the queued job.
*
* @return string
*/
public function displayName()
{
return get_class($this->notification);
}
}
8 changes: 2 additions & 6 deletions src/Illuminate/Queue/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Illuminate\Queue;

use Illuminate\Container\Container;
use Illuminate\Events\CallQueuedListener;

abstract class Queue
{
Expand Down Expand Up @@ -136,11 +135,8 @@ protected function createObjectPayload($job)
*/
protected function getDisplayName($job)
{
if ($job instanceof CallQueuedListener) {
return $job->class;
}

return get_class($job);
return method_exists($job, 'displayName')
? $job->displayName() : get_class($job);
}

/**
Expand Down

0 comments on commit d033626

Please sign in to comment.