96 lines
2.3 KiB
PHP
96 lines
2.3 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 WinningProofMail extends Mailable implements ShouldQueue
|
|
{
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
/** @var string */
|
|
private $stickerPath;
|
|
|
|
/** @var string */
|
|
private $ticketPath;
|
|
|
|
/** @var string */
|
|
private $barcodePath;
|
|
|
|
/**
|
|
* Participation
|
|
*
|
|
* @var Participation
|
|
*/
|
|
private $participation;
|
|
|
|
/**
|
|
* Customer
|
|
*
|
|
* @var CrmCustomer
|
|
*/
|
|
private $crmCustomer;
|
|
|
|
/**
|
|
* Settings
|
|
*
|
|
* @var Settings
|
|
*/
|
|
private $settings;
|
|
|
|
/**
|
|
* WinningProofMail
|
|
*
|
|
* @param string $stickerPath
|
|
* @param string $ticketPath
|
|
* @param string $barcodePath
|
|
* @param Participation $participation
|
|
* @param CrmCustomer $crmCustomer
|
|
* @param Settings $settings
|
|
*/
|
|
public function __construct(
|
|
string $stickerPath,
|
|
string $ticketPath,
|
|
string $barcodePath,
|
|
Participation $participation,
|
|
CrmCustomer $crmCustomer,
|
|
Settings $settings
|
|
) {
|
|
$this->stickerPath = $stickerPath;
|
|
$this->ticketPath = $ticketPath;
|
|
$this->barcodePath = $barcodePath;
|
|
$this->participation = $participation;
|
|
$this->crmCustomer = $crmCustomer;
|
|
$this->settings = $settings;
|
|
}
|
|
|
|
/**
|
|
* Build the message.
|
|
*
|
|
* @return $this
|
|
*/
|
|
public function build()
|
|
{
|
|
$participation = $this->participation;
|
|
$customer = $this->customer;
|
|
$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 . ' : Preuves de gain de ' .
|
|
$customer->lastname . ' ' . $customer->firstname;
|
|
return $this->subject($subject)->view(
|
|
'front.basic.winning-proof-email',
|
|
compact('participation', 'customer')
|
|
)->attach($this->stickerPath)->attach($this->ticketPath)
|
|
->attach($this->barcodePath);
|
|
}
|
|
}
|