renamed income/expense
This commit is contained in:
49
app/Jobs/Sale/CreateInvoiceHistory.php
Normal file
49
app/Jobs/Sale/CreateInvoiceHistory.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Sale;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Models\Sale\InvoiceHistory;
|
||||
|
||||
class CreateInvoiceHistory extends Job
|
||||
{
|
||||
protected $invoice;
|
||||
|
||||
protected $notify;
|
||||
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param $invoice
|
||||
* @param $notify
|
||||
* @param $description
|
||||
*/
|
||||
public function __construct($invoice, $notify = 0, $description = null)
|
||||
{
|
||||
$this->invoice = $invoice;
|
||||
$this->notify = $notify;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return InvoiceHistory
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$description = $this->description ?: trans_choice('general.payments', 1);
|
||||
|
||||
$invoice_history = InvoiceHistory::create([
|
||||
'company_id' => $this->invoice->company_id,
|
||||
'invoice_id' => $this->invoice->id,
|
||||
'status_code' => $this->invoice->invoice_status_code,
|
||||
'notify' => $this->notify,
|
||||
'description' => $description,
|
||||
]);
|
||||
|
||||
return $invoice_history;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user