Your IP : 216.73.216.91


Current Path : /var/www/html/LLCF-APP/app/Http/Requests/
Upload File :
Current File : /var/www/html/LLCF-APP/app/Http/Requests/UpdateHealthRequest.php

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UpdateHealthRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        $id = $this->route('id');

        return [
            'student_id' => [
                'required',
                'exists:student,id',
                Rule::unique('health')->where(function ($query) {
                    return $query->where('family_id', $this->family_id);
                })->ignore($id),
            ],
            'family_id' => [
                'required',
                'exists:family,id',
            ],
            'checkup_date' => 'required|date',
            'pulse' => 'nullable|numeric',
            'body_temp' => 'nullable|numeric',
            'respiration' => 'nullable|numeric',
            'bp' => 'nullable|string|max:20',
            'height_cm' => 'nullable|numeric',
            'weight' => 'nullable|numeric',
            'bmi' => 'nullable|numeric',
            'bmi_percentile' => 'nullable|numeric',
            'eye_left' => 'nullable|string|max:10',
            'eye_right' => 'nullable|string|max:10',
            'pallor' => 'nullable|string|max:100',
            'lice' => 'nullable|string|max:100',
            'consciousness' => 'nullable|string|max:100',
            'diet' => 'nullable|string|max:100',
            'teeth' => 'nullable|string|max:100',
            'history' => 'nullable|string',
            'diagnosis' => 'nullable|string',
            'management' => 'nullable|string',
            'advice' => 'nullable|string',
            'refer' => 'nullable|string|max:100',
            'followup' => 'nullable|string|max:100',
            'session' => 'nullable|string|max:50',
        ];
    }
}