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