60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\Participation;
|
|
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 NotifWinAdmin extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
/** @var Settings */
|
|
private $settings;
|
|
|
|
/** @var Settings */
|
|
private $participation;
|
|
|
|
/** @var CrmCustomer */
|
|
private $crmCustomer;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*
|
|
* @param CrmCustomer $crmCustomer
|
|
* @param Settings $settings
|
|
* @param Participation $participation
|
|
*/
|
|
public function __construct(CrmCustomer $crmCustomer, Settings $settings, Participation $participation)
|
|
{
|
|
$this->crmCustomer = $crmCustomer;
|
|
$this->settings = $settings;
|
|
$this->participation = $participation;
|
|
}
|
|
|
|
/**
|
|
* Build the message.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function build()
|
|
{
|
|
$subject = '';
|
|
if (!collect($this->to)->count()) {
|
|
$this->to(config('mail.MAIL_ADMIN'));
|
|
$subject = '!!! AUCUNE Valeur configurée dans settings email list. !!!';
|
|
}
|
|
$subject .= $this->settings->name . ' : un lot a été gagné';
|
|
return $this->subject($subject)
|
|
->view('front.basic.notif-win-admin-email', [
|
|
'crmCustomer' => $this->crmCustomer,
|
|
'participation' => $this->participation
|
|
]);
|
|
}
|
|
}
|