akaunting/app/Jobs/Purchase/CreateBillHistory.php

50 lines
1.0 KiB
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\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\BillHistory;
2019-11-16 10:21:14 +03:00
class CreateBillHistory extends Job
{
protected $bill;
protected $notify;
protected $description;
/**
* Create a new job instance.
*
* @param $bill
* @param $notify
* @param $description
*/
public function __construct($bill, $notify = 0, $description = null)
{
$this->bill = $bill;
$this->notify = $notify;
$this->description = $description;
}
/**
* Execute the job.
*
* @return BillHistory
*/
public function handle()
{
$description = $this->description ?: trans_choice('general.payments', 1);
$bill_history = BillHistory::create([
'company_id' => $this->bill->company_id,
'bill_id' => $this->bill->id,
'status_code' => $this->bill->bill_status_code,
'notify' => $this->notify,
'description' => $description,
]);
return $bill_history;
}
}