ConfirmPaymentNotification.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Notifications;
  3. use App\Models\Payment;
  4. use Illuminate\Bus\Queueable;
  5. use Illuminate\Contracts\Queue\ShouldQueue;
  6. use Illuminate\Notifications\Messages\MailMessage;
  7. use Illuminate\Notifications\Notification;
  8. class ConfirmPaymentNotification extends Notification implements ShouldQueue
  9. {
  10. use Queueable;
  11. private Payment $payment;
  12. /**
  13. * Create a new notification instance.
  14. *
  15. * @return void
  16. */
  17. public function __construct(Payment $payment)
  18. {
  19. $this->payment = $payment;
  20. }
  21. /**
  22. * Get the notification's delivery channels.
  23. *
  24. * @param mixed $notifiable
  25. * @return array
  26. */
  27. public function via($notifiable)
  28. {
  29. return ['mail'];
  30. }
  31. /**
  32. * Get the mail representation of the notification.
  33. *
  34. * @param mixed $notifiable
  35. * @return MailMessage
  36. */
  37. public function toMail($notifiable)
  38. {
  39. return (new MailMessage)
  40. ->subject('Payment Confirmation')
  41. ->markdown('mail.payment.confirmed' , ['payment' => $this->payment]);
  42. }
  43. /**
  44. * Get the array representation of the notification.
  45. *
  46. * @param mixed $notifiable
  47. * @return array
  48. */
  49. public function toArray($notifiable)
  50. {
  51. return [
  52. 'title' => "Payment Confirmed!",
  53. 'content' => "Payment Confirmed!",
  54. ];
  55. }
  56. }