ldc-gen-game-web/app/Mail/WinningProof.php
Noah Lancien 949b7ca13e phpcs
2023-08-24 12:59:51 +00:00

80 lines
2.1 KiB
PHP

<?php
namespace App\Mail;
use App\Models\Participation;
use App\Models\Settings;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class WinningProof extends Mailable implements ShouldQueue
{
use Queueable;
use SerializesModels;
/** @var string */
private $sticker;
/** @var string */
private $ticket;
/** @var string */
private $barcode;
/** @var \App\Models\Participation */
private $participation;
/** @var \App\Models\User */
private $user;
/** @var \App\Models\Settings */
private $settings;
/**
* Create a new message instance.
*
* @param string $sticker
* @param string $ticket
* @param string $barcode
* @param \App\Models\Participation $participation
* @param \App\Models\User $user
* @param \Models\Settings $settings
* @return void
*/
public function __construct(
string $sticker,
string $ticket,
string $barcode,
Participation $participation,
User $user,
Settings $settings
) {
$this->sticker = $sticker;
$this->ticket = $ticket;
$this->barcode = $barcode;
$this->participation = $participation;
$this->user = $user;
$this->settings = $settings;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$participation = $this->participation;
$user = $this->user;
$settings = $this->settings;
return $this->subject(
$this->settings->name . " : Preuves de gain de " . $this->user->lastname . " " . $this->user->firstname
)->view(
'front.basic.winning-proof-email',
compact('participation', 'user', 'settings')
)->attach($this->sticker)->attach($this->ticket)->attach($this->barcode);
}
}