akaunting/app/Jobs/Common/CreateWidget.php
2021-09-06 11:53:57 +03:00

23 lines
495 B
PHP

<?php
namespace App\Jobs\Common;
use App\Abstracts\Job;
use App\Interfaces\Job\HasOwner;
use App\Interfaces\Job\ShouldCreate;
use App\Models\Common\Widget;
class CreateWidget extends Job implements HasOwner, ShouldCreate
{
public function handle(): Widget
{
$this->request['enabled'] = $this->request['enabled'] ?? 1;
\DB::transaction(function () {
$this->widget = Widget::create($this->request->all());
});
return $this->widget;
}
}