| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/apache/htdocs/app/app/Notifications/ |
Upload File : |
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class InvoiceNotification extends Notification
{
use Queueable;
public $type;
public $username;
public $order_id;
public $pdf;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($data)
{
$this->type = $data['type'];
$this->username = $data['username'];
$this->order_id = $data['order_id'];
$this->pdf = base64_decode($data['pdf']);
}
/**
* 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)
{
if($this->type == 'booking')
{
return (new MailMessage)
->subject('Zlock APP - Your order #' . $this->order_id . ' has been processed.')
->line('Dear ' . $this->username)
->line("Order #" . $this->order_id . " has been processed, please find an invoice attached to this email")
->attachData($this->pdf, 'order_'.$this->order_id.'_invoice.pdf');
}
else if($this->type == 'overtime')
{
return (new MailMessage)
->subject('Zlock APP - Overtime charge incurred.')
->line('Dear ' . $this->username)
->line("For your order #" . $this->order_id . ", overtime charges has been applied to your account due to booking passed reserved time, please find an invoice attached to this email")
->attachData($this->pdf, 'order_'.$this->order_id.'_overtime_invoice.pdf');
}
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}