30 lines
720 B
PHP
30 lines
720 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Domain\Study\WorkflowLevel;
|
|
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(WorkflowLevel::class)->only([WorkflowLevel::DraftAvailable, WorkflowLevel::Finalized, WorkflowLevel::Published]),
|
|
],
|
|
];
|
|
}
|
|
}
|