| 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/apache2/htdocs/app/app/Jobs/ |
Upload File : |
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Notifications\InvoiceNotification;
use \PDF;
class SendInvoice implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $user;
protected $order_type;
protected $type;
protected $order_info;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($data)
{
$this->user = $data['user'];
$this->order_type = $data['order_type'];
$this->type = $data['type'];
$this->order_info = $data['order_info'];
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if($this->order_type == 'delivery')
{
$pdf = PDF::loadView('invoice.delivery_invoice', ['data' => $this->order_info]);
}
else if($this->order_type == 'inventory')
{
if($this->type == "booking")
$pdf = PDF::loadView('invoice.user2user_invoice', ['data' => $this->order_info]);
else if($this->type == "overtime")
$pdf = PDF::loadView('invoice.overtime_invoice', ['data' => $this->order_info]);
}
$this->user->notify(new InvoiceNotification([
'type' => $this->type,
'username' => $this->user->full_name,
'order_id' => $this->order_info->id,
'pdf' => base64_encode($pdf->output()),
]));
}
}