From 717f1f67eb7bb2fac7c57311f0afaa637375407d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 28 Feb 2017 07:38:15 -0600 Subject: [PATCH] extract method --- src/Illuminate/Mail/Mailer.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Illuminate/Mail/Mailer.php b/src/Illuminate/Mail/Mailer.php index 118ee63f6272..eab88d7730cd 100755 --- a/src/Illuminate/Mail/Mailer.php +++ b/src/Illuminate/Mail/Mailer.php @@ -182,11 +182,7 @@ public function plain($view, array $data, $callback) public function send($view, array $data = [], $callback = null) { if ($view instanceof MailableContract) { - if ($view instanceof ShouldQueue) { - return $view->queue($this->queue); - } - - return $view->send($this); + return $this->sendMailable($view); } // First we need to parse the view, which could either be a string or an array @@ -213,6 +209,18 @@ public function send($view, array $data = [], $callback = null) $this->sendSwiftMessage($message->getSwiftMessage()); } + /** + * Send the given mailable. + * + * @param MailableContract $mailable + * @return void + */ + protected function sendMailable($mailable) + { + return $mailable instanceof ShouldQueue + ? $mailable->queue($this->queue) : $mailable->send($this); + } + /** * Parse the given view name or array. *