Add name in From field.

This commit is contained in:
mdpoulter
2020-01-27 14:50:56 +02:00
parent 3401ca049e
commit 8ce7e14a02
8 changed files with 22 additions and 78 deletions

View File

@ -12,17 +12,14 @@ class EstimatePdf extends Mailable
public $data = [];
public $notificationEmail = '';
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $notificationEmail)
public function __construct($data)
{
$this->data = $data;
$this->notificationEmail = $notificationEmail;
}
/**
@ -33,8 +30,8 @@ class EstimatePdf extends Mailable
public function build()
{
$company = $this->data['company']['name'];
return $this->from($this->notificationEmail)
->subject("Estimate from $company")
return $this->subject("Estimate from $company")
->markdown('emails.send.estimate', ['data', $this->data]);
}
}

View File

@ -31,6 +31,8 @@ class EstimateViewed extends Mailable
public function build()
{
$email = $this->data['user']['email'];
return $this->from($email)->markdown('emails.viewed.estimate', ['data', $this->data]);
$name = $this->data['user']['name'];
return $this->from($email, $name)
->markdown('emails.viewed.estimate', ['data', $this->data]);
}
}

View File

@ -6,23 +6,20 @@ use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class invoicePdf extends Mailable
class InvoicePdf extends Mailable
{
use Queueable, SerializesModels;
public $data = [];
public $notificationEmail = '';
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $notificationEmail)
public function __construct($data)
{
$this->data = $data;
$this->notificationEmail = $notificationEmail;
}
/**
@ -33,8 +30,8 @@ class invoicePdf extends Mailable
public function build()
{
$company = $this->data['company']['name'];
return $this->from($this->notificationEmail)
->subject("Invoice from $company")
return $this->subject("Invoice from $company")
->markdown('emails.send.invoice', ['data', $this->data]);
}
}

View File

@ -31,6 +31,8 @@ class InvoiceViewed extends Mailable
public function build()
{
$email = $this->data['user']['email'];
return $this->from($email)->markdown('emails.viewed.invoice', ['data', $this->data]);
$name = $this->data['user']['name'];
return $this->from($email, $name)
->markdown('emails.viewed.invoice', ['data', $this->data]);
}
}

View File

@ -13,17 +13,14 @@ class PaymentPdf extends Mailable
public $data = [];
public $notificationEmail = '';
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $notificationEmail)
public function __construct($data)
{
$this->data = $data;
$this->notificationEmail = $notificationEmail;
}
/**
@ -34,8 +31,8 @@ class PaymentPdf extends Mailable
public function build()
{
$company = $this->data['company']['name'];
return $this->from($this->notificationEmail)
->subject("Payment from $company")
return $this->subject("Payment from $company")
->markdown('emails.send.payment', ['data', $this->data]);
}
}