Permalink
Browse files

Make InteractsWithMail::getMessagesFor backwards compatible with Lara…

…vel 5.2.
  • Loading branch information...
systemovich committed Nov 8, 2017
1 parent 1756e25 commit 63b8bbf99cf653ff388d36338102d18e05b3dfc9
Showing with 12 additions and 11 deletions.
  1. +11 −10 src/Message.php
  2. +1 −1 src/Testing/InteractsWithMail.php
View
@@ -4,6 +4,7 @@
use Exception;
use Illuminate\Support\Arr;
use MailThief\Support\MailThiefCollection;
class Message
{
@@ -38,12 +39,12 @@ public function __construct($view, $data)
{
$this->view = $view;
$this->data = $data;
$this->to = collect();
$this->cc = collect();
$this->bcc = collect();
$this->reply_to = collect();
$this->attachments = collect();
$this->headers = collect();
$this->to = new MailThiefCollection();
$this->cc = new MailThiefCollection();
$this->bcc = new MailThiefCollection();
$this->reply_to = new MailThiefCollection();
$this->attachments = new MailThiefCollection();
$this->headers = new MailThiefCollection();
}
public function __call($name, $arguments)
@@ -79,9 +80,9 @@ public function subject($subject)
public function to($address, $name = null, $override = false)
{
if ($override) {
$this->to = collect();
$this->to = new MailThiefCollection();
}
if (! is_array($address)) {
$address = $name ? [$address => $name] : [$address];
}
@@ -130,7 +131,7 @@ public function from($address, $name = null)
$address = $name ? [$address => $name] : [$address];
}
$this->from = collect($address);
$this->from = new MailThiefCollection($address);
return $this;
}
@@ -141,7 +142,7 @@ public function sender($address, $name = null)
$address = $name ? [$address => $name] : [$address];
}
$this->sender = collect($address);
$this->sender = new MailThiefCollection($address);
return $this;
}
@@ -39,7 +39,7 @@ public function getMessages()
*/
public function getMessagesFor($emails)
{
$emails = collect((array) $emails);
$emails = new MailThiefCollection((array) $emails);
return $this->getMessages()->filter(function (Message $message) use ($emails) {
return $emails->contains(function ($email) use ($message) {

0 comments on commit 63b8bbf

Please sign in to comment.