PaymentReceived.php 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. ->line(__('Payment for #:sn has been received! Total amount: ¥:amount.', ['sn' => $this->sn, 'amount' => $this->amount]))
  25. ->action(__('Invoice Detail'), route('invoiceInfo', $this->sn));
  26. }
  27. public function toDataBase($notifiable)
  28. {
  29. return [
  30. 'sn' => $this->sn,
  31. 'amount' => $this->amount,
  32. ];
  33. }
  34. }