route('session')->user_id === auth()->id(); } /** * Get the validation rules that apply to the request. */ public function rules(): array { return [ 'answers' => ['sometimes', 'array'], 'answers.*.value' => ['nullable', 'string', 'in:yes,no,not_applicable'], 'answers.*.text_value' => ['nullable', 'string', 'max:10000'], 'additional_comments' => ['sometimes', 'nullable', 'string', 'max:10000'], 'complete' => ['sometimes', 'boolean'], ]; } /** * Custom validation messages. */ public function messages(): array { return [ 'answers.array' => 'Answers must be a valid data structure.', 'answers.*.value.in' => 'Answer value must be yes, no, or not_applicable.', 'answers.*.text_value.string' => 'Answer text must be text.', 'answers.*.text_value.max' => 'Answer text cannot exceed 10000 characters.', 'additional_comments.string' => 'Additional comments must be text.', 'additional_comments.max' => 'Additional comments cannot exceed 10000 characters.', 'complete.boolean' => 'The complete flag must be true or false.', ]; } }