diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index a25c26b8b526..c9ab3ea72020 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -91,6 +91,7 @@ class Invoice extends BaseModel 'auto_bill_enabled', 'uses_inclusive_taxes', 'vendor_id', + 'auto_bill_tries' ]; protected $casts = [ @@ -445,14 +446,14 @@ class Invoice extends BaseModel $file_path = CreateEntityPdf::dispatchNow($invitation, config('filesystems.default')); return Storage::disk(config('filesystems.default'))->{$type}($file_path); } - + try{ $file_exists = Storage::disk('public')->exists($file_path); } catch(\Exception $e){ nlog($e->getMessage()); - + } if($file_exists) @@ -553,10 +554,10 @@ class Invoice extends BaseModel $invoice = $this->fresh(); return [ - 'invoice_id' => $invoice->id, - 'invoice_amount' => $invoice->amount ?: 0, - 'invoice_partial' => $invoice->partial ?: 0, - 'invoice_balance' => $invoice->balance ?: 0, + 'invoice_id' => $invoice->id, + 'invoice_amount' => $invoice->amount ?: 0, + 'invoice_partial' => $invoice->partial ?: 0, + 'invoice_balance' => $invoice->balance ?: 0, 'invoice_paid_to_date' => $invoice->paid_to_date ?: 0, 'invoice_status' => $invoice->status_id ?: 1, ]; diff --git a/database/migrations/2022_05_16_224917_add_auto_bill_tries_to_invoices_table.php b/database/migrations/2022_05_16_224917_add_auto_bill_tries_to_invoices_table.php new file mode 100644 index 000000000000..befc660c0cbf --- /dev/null +++ b/database/migrations/2022_05_16_224917_add_auto_bill_tries_to_invoices_table.php @@ -0,0 +1,32 @@ +smallInteger('auto_bill_tries')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('invoices', function (Blueprint $table) { + $table->dropColumn('auto_bill_tries'); + }); + } +}