akaunting/app/Jobs/Setting/CreateTax.php

39 lines
671 B
PHP
Raw Normal View History

2019-11-16 10:21:14 +03:00
<?php
namespace App\Jobs\Setting;
use App\Abstracts\Job;
use App\Models\Setting\Tax;
class CreateTax extends Job
{
2020-06-26 13:40:19 +03:00
protected $tax;
2019-11-16 10:21:14 +03:00
protected $request;
/**
* Create a new job instance.
*
* @param $request
*/
public function __construct($request)
{
$this->request = $this->getRequestInstance($request);
2021-06-17 10:59:07 +03:00
$this->request->merge(['created_by' => user_id()]);
2019-11-16 10:21:14 +03:00
}
/**
* Execute the job.
*
* @return Tax
*/
public function handle()
{
2020-06-26 13:40:19 +03:00
\DB::transaction(function () {
$this->tax = Tax::create($this->request->all());
});
2019-11-16 10:21:14 +03:00
2020-06-26 13:40:19 +03:00
return $this->tax;
2019-11-16 10:21:14 +03:00
}
}