akaunting/app/Jobs/Common/CreateWidget.php

22 lines
471 B
PHP
Raw Normal View History

<?php
namespace App\Jobs\Common;
use App\Abstracts\Job;
2021-09-06 11:53:57 +03:00
use App\Interfaces\Job\HasOwner;
2021-09-07 10:33:34 +03:00
use App\Interfaces\Job\HasSource;
2021-09-06 11:53:57 +03:00
use App\Interfaces\Job\ShouldCreate;
use App\Models\Common\Widget;
2021-09-07 10:33:34 +03:00
class CreateWidget extends Job implements HasOwner, HasSource, ShouldCreate
{
2021-09-06 11:53:57 +03:00
public function handle(): Widget
{
\DB::transaction(function () {
$this->widget = Widget::create($this->request->all());
});
return $this->widget;
}
}