ldc-crm/app/Mail/ClaimAnswerMail.php
2025-08-04 16:03:38 +02:00

70 lines
1.8 KiB
PHP

<?php
namespace App\Mail;
use App\Models\Claim;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class ClaimAnswerMail extends Mailable implements ShouldQueue
{
use Queueable;
use SerializesModels;
/**
* The current claim.
*
* @var \App\Models\Claim
*/
protected $claimModel;
/**
* The answer of the current claim.
*
* @var string
*/
protected $answer;
/**
* Create a new message instance.
*
* @param \App\Models\Claim $claimModel
* @param string $answer
* @return void
*/
public function __construct(Claim $claimModel, string $answer)
{
$this->claimModel = $claimModel;
$this->answer = $answer;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this
->from("no-reply@{$this->claimModel->brand->domain}")
->subject(sprintf(
'Réponse réclamation %s - %s',
$this->claimModel->reference,
$this->claimModel->brand->name
))
->markdown('mail.send-claim-answer')
->text('mail.send-claim-answer-plain')
->with([
'customHeader' => view('vendor.mail.html.header-claim-answer', [
'brandModel' => $this->claimModel->brand,
])->render(),
'customFooter' => view('vendor.mail.html.footer-claim-answer', [
'brandModel' => $this->claimModel->brand,
])->render(),
'claimModel' => $this->claimModel,
'answer' => $this->answer,
]);
}
}