<?php
namespace App\Notifications\User;
use Carbon\Carbon;
use App\Models\Transaction;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class AddMoneyNotification extends Notification
{
use Queueable;
public $id;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($id)
{
$this->id= $id;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$id = $this->id;
$transaction = Transaction::auth()->with(['payment_gateway'])->where('id',$id)->first();
$date = Carbon::now();
$dateTime = $date->format('Y-m-d h:i:s A');
return (new MailMessage)
->greeting("Hello ". auth()->user()->fullname." !")
->subject("Add Money using " . $transaction->payment_gateway->name)
->line("Request Amount: " . get_amount($transaction->request_amount,$transaction->request_currency,2))
->line("Payable Amount: " . get_amount($transaction->total_payable,$transaction->payment_currency,2))
->line("Status: " .$transaction->stringStatus->value)
->line("Date And Time: " .$dateTime)
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
Before you begin integrating the Kueue Pay Developer API, make sure you have: