Skip to content

Commit 460f329

Browse files
committed
Make mailable properties public
1 parent 40b0217 commit 460f329

2 files changed

Lines changed: 18 additions & 56 deletions

File tree

src/Illuminate/Mail/Mailable.php

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,84 +19,84 @@ class Mailable implements MailableContract
1919
*
2020
* @var array
2121
*/
22-
protected $from = [];
22+
public $from = [];
2323

2424
/**
2525
* The "to" recipients of the message.
2626
*
2727
* @var array
2828
*/
29-
protected $to = [];
29+
public $to = [];
3030

3131
/**
3232
* The "cc" recipients of the message.
3333
*
3434
* @var array
3535
*/
36-
protected $cc = [];
36+
public $cc = [];
3737

3838
/**
3939
* The "bcc" recipients of the message.
4040
*
4141
* @var array
4242
*/
43-
protected $bcc = [];
43+
public $bcc = [];
4444

4545
/**
4646
* The "reply to" recipients of the message.
4747
*
4848
* @var array
4949
*/
50-
protected $replyTo = [];
50+
public $replyTo = [];
5151

5252
/**
5353
* The subject of the message.
5454
*
5555
* @var string
5656
*/
57-
protected $subject;
57+
public $subject;
5858

5959
/**
6060
* The view to use for the message.
6161
*
6262
* @var string
6363
*/
64-
protected $view;
64+
public $view;
6565

6666
/**
6767
* The plain text view to use for the message.
6868
*
6969
* @var string
7070
*/
71-
protected $textView;
71+
public $textView;
7272

7373
/**
7474
* The view data for the message.
7575
*
7676
* @var array
7777
*/
78-
protected $viewData = [];
78+
public $viewData = [];
7979

8080
/**
8181
* The attachments for the message.
8282
*
8383
* @var array
8484
*/
85-
protected $attachments = [];
85+
public $attachments = [];
8686

8787
/**
8888
* The raw attachments for the message.
8989
*
9090
* @var array
9191
*/
92-
protected $rawAttachments = [];
92+
public $rawAttachments = [];
9393

9494
/**
9595
* The callbacks for the message.
9696
*
9797
* @var array
9898
*/
99-
protected $callbacks = [];
99+
public $callbacks = [];
100100

101101
/**
102102
* Send the message using the given mailer.
@@ -190,7 +190,9 @@ protected function buildViewData()
190190
$data = $this->viewData;
191191

192192
foreach ((new ReflectionClass($this))->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
193-
$data[$property->getName()] = $property->getValue($this);
193+
if ($property->getDeclaringClass()->getName() != self::class) {
194+
$data[$property->getName()] = $property->getValue($this);
195+
}
194196
}
195197

196198
return $data;
@@ -505,46 +507,6 @@ public function withSwiftMessage($callback)
505507
return $this;
506508
}
507509

508-
/**
509-
* Get the sender of the message.
510-
*
511-
* @return array
512-
*/
513-
public function getFrom()
514-
{
515-
return $this->from;
516-
}
517-
518-
/**
519-
* Get the "to" recipients of the message.
520-
*
521-
* @return array
522-
*/
523-
public function getTo()
524-
{
525-
return $this->to;
526-
}
527-
528-
/**
529-
* Get the "bcc" recipients of the message.
530-
*
531-
* @return array
532-
*/
533-
public function getBcc()
534-
{
535-
return $this->bcc;
536-
}
537-
538-
/**
539-
* Get the "cc" recipients of the message.
540-
*
541-
* @return array
542-
*/
543-
public function getCc()
544-
{
545-
return $this->cc;
546-
}
547-
548510
/**
549511
* Dynamically bind parameters to the message.
550512
*

src/Illuminate/Support/Testing/Fakes/MailFake.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,15 +212,15 @@ public function send($view, array $data = [], $callback = null)
212212

213213
$mailable->mailable = $view;
214214

215-
if ($recipients = $view->getTo()) {
215+
if ($recipients = $view->to) {
216216
$mailable->to($recipients);
217217
}
218218

219-
if ($recipients = $view->getBcc()) {
219+
if ($recipients = $view->bcc) {
220220
$mailable->bcc($recipients);
221221
}
222222

223-
if ($recipients = $view->getCc()) {
223+
if ($recipients = $view->cc) {
224224
$mailable->cc($recipients);
225225
}
226226

0 commit comments

Comments
 (0)