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/StoreFamilyRequest.php

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'father_name'      => 'required|string|min:3',
            'father_cnic'      => ['required', 'regex:/^\d{5}-\d{7}-\d{1}$/'],
            'father_phone'     => ['required', 'regex:/^03\d{9}$/'],
            'father_occup'     => 'required|string',
            'address'          => 'required|string',
            'mother_name'      => 'required|string',
            'mother_cnic'      => ['required', 'regex:/^\d{5}-\d{7}-\d{1}$/'],
            'mother_occup'     => 'required|string',
            'children_count'   => 'required|integer|min:0',
            'zakat'            => 'required|in:yes,no',
            'religion'         => 'required|string|max:12',
            'emerg_name'       => 'required|string',
            'emerg_relation'   => 'required|string',
            'emerg_num'        => ['required', 'regex:/^03\d{9}$/'],
        ];
    }

    public function messages(): array
    {
        return [
            'father_cnic.regex'   => 'Father CNIC must be in the format 12345-1234567-1',
            'mother_cnic.regex'   => 'Mother CNIC must be in the format 12345-1234567-1',
            'father_phone.regex'  => 'Father phone must be a valid 11-digit number starting with 03',
            'emerg_num.regex'     => 'Emergency number must be a valid 11-digit number starting with 03',
        ];
    }
}