complete story 8.5 with qa tests
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Mail\BookingRejectedEmail;
|
||||
use App\Models\Consultation;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class BookingRejected extends Notification implements ShouldQueue
|
||||
@@ -33,28 +34,10 @@ class BookingRejected extends Notification implements ShouldQueue
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*/
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
public function toMail(object $notifiable): Mailable
|
||||
{
|
||||
$locale = $notifiable->preferred_language ?? 'ar';
|
||||
|
||||
return (new MailMessage)
|
||||
->subject($this->getSubject($locale))
|
||||
->view('emails.booking-rejected', [
|
||||
'consultation' => $this->consultation,
|
||||
'rejectionReason' => $this->rejectionReason,
|
||||
'locale' => $locale,
|
||||
'user' => $notifiable,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subject based on locale.
|
||||
*/
|
||||
private function getSubject(string $locale): string
|
||||
{
|
||||
return $locale === 'ar'
|
||||
? 'بخصوص طلب الاستشارة الخاص بك'
|
||||
: 'Regarding Your Consultation Request';
|
||||
return (new BookingRejectedEmail($this->consultation, $this->rejectionReason))
|
||||
->to($notifiable->email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user