added pointer interfaces for jobs

This commit is contained in:
Denis Duliçi
2021-09-06 11:53:57 +03:00
parent abd55133f1
commit c08a8cfc4e
63 changed files with 635 additions and 1524 deletions

View File

@ -3,36 +3,18 @@
namespace App\Jobs\Common;
use App\Abstracts\Job;
use App\Interfaces\Job\HasOwner;
use App\Interfaces\Job\ShouldCreate;
use App\Models\Common\Report;
class CreateReport extends Job
class CreateReport extends Job implements HasOwner, ShouldCreate
{
protected $report;
protected $request;
/**
* Create a new job instance.
*
* @param $request
*/
public function __construct($request)
{
$this->request = $this->getRequestInstance($request);
$this->request->merge(['created_by' => user_id()]);
}
/**
* Execute the job.
*
* @return Report
*/
public function handle()
public function handle(): Report
{
\DB::transaction(function () {
$this->report = Report::create($this->request->all());
$this->model = Report::create($this->request->all());
});
return $this->report;
return $this->model;
}
}