mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
35 lines
870 B
PHP
35 lines
870 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Services;
|
|
|
|
|
|
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
|
use App\Models\Company;
|
|
|
|
class UpdatesCompanyEInvoiceRequest extends AbstractUpdateRecord
|
|
{
|
|
|
|
/**
|
|
* @param Company $model
|
|
* @param bool $eInvoice
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
*/
|
|
public function execute(Company $model, bool $eInvoice)
|
|
{
|
|
if($eInvoice){
|
|
if (is_null($model->e_invoice_requested_at)) {
|
|
if($eInvoice){
|
|
$model->e_invoice_requested_at = now();
|
|
}
|
|
}
|
|
$model->e_invoice = 1;
|
|
}
|
|
else{
|
|
$model->e_invoice_requested_at = null;
|
|
$model->e_invoice = 0;
|
|
}
|
|
return $this->handler($model);
|
|
}
|
|
}
|