42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use App\Models\TimelineUpdate;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
|
|
class TimelineUpdateEmail extends BaseMailable
|
|
{
|
|
public function __construct(
|
|
public TimelineUpdate $update
|
|
) {
|
|
$this->locale = $this->update->timeline->user->preferred_language ?? 'ar';
|
|
}
|
|
|
|
public function envelope(): Envelope
|
|
{
|
|
$caseName = $this->update->timeline->case_name;
|
|
|
|
$subject = $this->locale === 'ar'
|
|
? "تحديث على قضيتك: {$caseName}"
|
|
: "Update on your case: {$caseName}";
|
|
|
|
return new Envelope(
|
|
subject: $subject,
|
|
);
|
|
}
|
|
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
markdown: "emails.timeline.update.{$this->locale}",
|
|
with: [
|
|
'update' => $this->update,
|
|
'timeline' => $this->update->timeline,
|
|
'user' => $this->update->timeline->user,
|
|
],
|
|
);
|
|
}
|
|
}
|