Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit a6b3354

Browse files
authored
Merge pull request #89 from systemovich/more_collection_backwards_compatibility
Make InteractsWithMail::getMessagesFor compatible with Laravel 5.2
2 parents 1756e25 + 63b8bbf commit a6b3354

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/Message.php

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Exception;
66
use Illuminate\Support\Arr;
7+
use MailThief\Support\MailThiefCollection;
78

89
class Message
910
{
@@ -38,12 +39,12 @@ public function __construct($view, $data)
3839
{
3940
$this->view = $view;
4041
$this->data = $data;
41-
$this->to = collect();
42-
$this->cc = collect();
43-
$this->bcc = collect();
44-
$this->reply_to = collect();
45-
$this->attachments = collect();
46-
$this->headers = collect();
42+
$this->to = new MailThiefCollection();
43+
$this->cc = new MailThiefCollection();
44+
$this->bcc = new MailThiefCollection();
45+
$this->reply_to = new MailThiefCollection();
46+
$this->attachments = new MailThiefCollection();
47+
$this->headers = new MailThiefCollection();
4748
}
4849

4950
public function __call($name, $arguments)
@@ -79,9 +80,9 @@ public function subject($subject)
7980
public function to($address, $name = null, $override = false)
8081
{
8182
if ($override) {
82-
$this->to = collect();
83+
$this->to = new MailThiefCollection();
8384
}
84-
85+
8586
if (! is_array($address)) {
8687
$address = $name ? [$address => $name] : [$address];
8788
}
@@ -130,7 +131,7 @@ public function from($address, $name = null)
130131
$address = $name ? [$address => $name] : [$address];
131132
}
132133

133-
$this->from = collect($address);
134+
$this->from = new MailThiefCollection($address);
134135

135136
return $this;
136137
}
@@ -141,7 +142,7 @@ public function sender($address, $name = null)
141142
$address = $name ? [$address => $name] : [$address];
142143
}
143144

144-
$this->sender = collect($address);
145+
$this->sender = new MailThiefCollection($address);
145146

146147
return $this;
147148
}

src/Testing/InteractsWithMail.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getMessages()
3939
*/
4040
public function getMessagesFor($emails)
4141
{
42-
$emails = collect((array) $emails);
42+
$emails = new MailThiefCollection((array) $emails);
4343

4444
return $this->getMessages()->filter(function (Message $message) use ($emails) {
4545
return $emails->contains(function ($email) use ($message) {

0 commit comments

Comments
 (0)