ldc-gen-game-web/app/Mail/ReductionWon.php

62 lines
1.6 KiB
PHP

<?php
namespace App\Mail;
use App\Models\Reduction;
use App\Models\Settings;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use LDC\LDCCRM\Models\Customer as CrmCustomer;
class ReductionWon extends Mailable implements ShouldQueue
{
use Queueable;
use SerializesModels;
/** @var CrmCustomer */
private $crmCustomer;
/** @var integer */
private $faceValue;
/** @var Settings */
private $settings;
/** @var Reduction */
private $reduction;
/**
* Create a new message instance.
*
* @param CrmCustomer $crmCustomer
* @param integer $faceValue
* @param Settings $settings
* @param Reduction $reduction
*/
public function __construct(CrmCustomer $crmCustomer, int $faceValue, Settings $settings, Reduction $reduction)
{
$this->crmCustomer = $crmCustomer;
$this->faceValue = $faceValue;
$this->settings = $settings;
$this->reduction = $reduction;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject($this->customer->firstname . ", n'attendez plus pour imprimer votre bon d'achat " .
$this->settings->name . " !")->view('front.basic.reduction-mail')
->with([
'crmCustomer' => $this->crmCustomer,
'faceValue' => $this->faceValue,
'settings' => $this->settings,
'link' => $this->reduction->link
]);
}
}