PaymentReceived.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Notifications;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Contracts\Queue\ShouldQueue;
  5. use Illuminate\Notifications\Messages\MailMessage;
  6. use Illuminate\Notifications\Notification;
  7. class PaymentReceived extends Notification implements ShouldQueue
  8. {
  9. use Queueable;
  10. private $amount;
  11. private $sn;
  12. public function __construct($sn, $amount)
  13. {
  14. $this->amount = $amount;
  15. $this->sn = $sn;
  16. }
  17. public function via($notifiable)
  18. {
  19. return sysConfig('payment_received_notification');
  20. }
  21. public function toMail($notifiable)
  22. {
  23. return (new MailMessage)
  24. ->subject(__('Payment Received'))
  25. ->line(__('Payment for #:sn has been received! Total amount: ¥:amount.', ['sn' => $this->sn, 'amount' => $this->amount]))
  26. ->action(__('Invoice Detail'), route('invoiceInfo', $this->sn));
  27. }
  28. public function toDataBase($notifiable)
  29. {
  30. return [
  31. 'sn' => $this->sn,
  32. 'amount' => $this->amount,
  33. ];
  34. }
  35. }