Current File : /home/tradevaly/public_html/app/Notifications/User/Subscription/SubscriptionInvoice.php
<?php

namespace App\Notifications\User\Subscription;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class SubscriptionInvoice extends Notification
{
    use Queueable;
    public $data;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * 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)
    {
        return (new MailMessage)
            ->subject('Your Subscription Invoice')
            // ->view( 'mail.user.subscription.purchaseInvoice', ['data' => $this->data]);
        ->greeting('Hello ' . $this->data->name)
        ->line('Thank you for choosing our subscription service! 🎉')
        ->line('Below are the details of your subscription invoice:')
        ->line('Invoice Date: ' . now()->toFormattedDateString())
        ->line('Subscription Plan: Premium Membership')
        ->line('Subscription Period: ' . $this->data->start->toFormattedDateString() . ' to ' . $this->data->end->toFormattedDateString())
        ->line('Amount: BDT' . $this->data->amount)
        ->line('Package: ' . $this->data->package)
        ->line('Payment Status: pending' )
        ->action('Download Invoice', route('user.subscription.invoice',$this->data->id))
        ->line('Please make the payment to continue enjoying our premium services.')
        ->line('If you have any questions or need assistance, please feel free to reach out to our support team.')
        ->line('Thank you for being a valued member of Tradevaly!');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}