30 lines
712 B
PHP
30 lines
712 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Domain\Report\ReportStatus;
|
|
use App\Models\Study;
|
|
use App\Rules\ExistsByHash;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreReportRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'hashid' => ['required', new ExistsByHash(Study::class)],
|
|
'content' => 'required',
|
|
'report_status' => [
|
|
'required',
|
|
Rule::enum(ReportStatus::class)->only([ReportStatus::Preliminary, ReportStatus::Finalized, ReportStatus::Approved]),
|
|
],
|
|
];
|
|
}
|
|
}
|