Skip to content

Commit

Permalink
[5.5] Support failed method in mailables and notifications (#21585)
Browse files Browse the repository at this point in the history
*         support failed method in mailables and notifications

*    fix style
  • Loading branch information
themsaid authored and taylorotwell committed Oct 8, 2017
1 parent 04e5b33 commit fd88ff8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Illuminate/Mail/SendQueuedMailable.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ public function displayName()
return get_class($this->mailable);
}

/**
* Call the failed method on the mailable instance.
*
* @param \Exception $e
* @return void
*/
public function failed($e)
{
if (method_exists($this->mailable, 'failed')) {
$this->mailable->failed($e);
}
}

/**
* Prepare the instance for cloning.
*
Expand Down
13 changes: 13 additions & 0 deletions src/Illuminate/Notifications/SendQueuedNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ public function displayName()
return get_class($this->notification);
}

/**
* Call the failed method on the notification instance.
*
* @param \Exception $e
* @return void
*/
public function failed($e)
{
if (method_exists($this->notification, 'failed')) {
$this->notification->failed($e);
}
}

/**
* Prepare the instance for cloning.
*
Expand Down

1 comment on commit fd88ff8

@brayniverse
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely addition

Please sign in to comment.