Files
healthcareapi/app/Http/Requests/CreateCommentRequest.php
2026-06-08 19:58:50 +07:00

37 lines
862 B
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CreateCommentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
protected function prepareForValidation(): void
{
$this->merge([
'diseaseId' => $this->route('diseaseId')
]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'diseaseId' => 'required|exists:diseases,id',
'content' => 'required|string|max:1000',
'parent_id' => 'nullable|exists:comments,id',
];
}
}