CaiWuXiTong/app/Jobs/Common/CreateReport.php
WuYongJie 9595267ee7
Some checks failed
Tests / PHP 8.1 (push) Has been cancelled
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
chore: 导入 Akaunting 初始源码与团队协作规则
2026-07-20 18:20:25 +08:00

31 lines
875 B
PHP

<?php
namespace App\Jobs\Common;
use App\Abstracts\Job;
use App\Interfaces\Job\HasOwner;
use App\Interfaces\Job\HasSource;
use App\Interfaces\Job\ShouldCreate;
use App\Models\Common\Report;
class CreateReport extends Job implements HasOwner, HasSource, ShouldCreate
{
public function handle(): Report
{
// Security: strip HTML tags from description to prevent stored XSS.
// The textarea and index views now use {{ }} encoding, but this
// defense-in-depth ensures no raw HTML is persisted.
if ($this->request->has('description')) {
$this->request->merge([
'description' => strip_tags($this->request->get('description')),
]);
}
\DB::transaction(function () {
$this->model = Report::create($this->request->all());
});
return $this->model;
}
}