akaunting/app/Jobs/Sale/DeleteInvoice.php

38 lines
637 B
PHP
Raw Normal View History

2019-11-16 10:21:14 +03:00
<?php
2019-12-31 15:49:09 +03:00
namespace App\Jobs\Sale;
2019-11-16 10:21:14 +03:00
use App\Abstracts\Job;
2019-12-31 15:49:09 +03:00
use App\Models\Sale\Invoice;
2019-11-16 10:21:14 +03:00
class DeleteInvoice extends Job
{
protected $invoice;
/**
* Create a new job instance.
*
* @param $invoice
*/
public function __construct($invoice)
{
$this->invoice = $invoice;
}
/**
* Execute the job.
*
* @return Invoice
*/
public function handle()
{
$this->deleteRelationships($this->invoice, [
'items', 'item_taxes', 'histories', 'transactions', 'recurring', 'totals'
]);
$this->invoice->delete();
return true;
}
}