build version 400

This commit is contained in:
Mohit Panjwani
2020-12-02 17:54:08 +05:30
parent 326508e567
commit 89ee58590c
963 changed files with 62887 additions and 48868 deletions

View File

@ -0,0 +1,61 @@
<?php
namespace Crater\Jobs;
use Crater\Models\FileDisk;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Spatie\Backup\Tasks\Backup\BackupJobFactory;
class CreateBackupJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $data;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($data = '')
{
$this->data = $data;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$fileDisk = FileDisk::find($this->data['file_disk_id']);
$fileDisk->setConfig();
$prefix = env('DYNAMIC_DISK_PREFIX', 'temp_');
config(['backup.backup.destination.disks' => [$prefix . $fileDisk->driver]]);
$backupJob = BackupJobFactory::createFromArray(config('backup'));
if ($this->data['option'] === 'only-db') {
$backupJob->dontBackupFilesystem();
}
if ($this->data['option'] === 'only-files') {
$backupJob->dontBackupDatabases();
}
if (! empty($this->data['option'])) {
$prefix = str_replace('_', '-', $this->data['option']).'-';
$backupJob->setFilename($prefix.date('Y-m-d-H-i-s').'.zip');
}
$backupJob->run();
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class GenerateEstimatePdfJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $estimate;
public $deleteExistingFile;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($estimate, $deleteExistingFile = false)
{
$this->estimate = $estimate;
$this->deleteExistingFile = $deleteExistingFile;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->estimate->generatePDF('estimate', $this->estimate->estimate_number, $this->deleteExistingFile);
return 0;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class GenerateInvoicePdfJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $invoice;
public $deleteExistingFile;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($invoice, $deleteExistingFile = false)
{
$this->invoice = $invoice;
$this->deleteExistingFile = $deleteExistingFile;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->invoice->generatePDF('invoice', $this->invoice->invoice_number, $this->deleteExistingFile);
return 0;
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace Crater\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class GeneratePaymentPdfJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $payment;
public $deleteExistingFile;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($payment, $deleteExistingFile = false)
{
$this->payment = $payment;
$this->deleteExistingFile = $deleteExistingFile;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$this->payment->generatePDF('payment', $this->payment->payment_number, $this->deleteExistingFile);
return 0;
}
}