| Current Path : /var/www/html/LLCF-APP/app/Http/Requests/ |
| Current File : /var/www/html/LLCF-APP/app/Http/Requests/StoreDonorRequest.php |
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreDonorRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'donor_name' => 'required|string|min:3|max:255',
'donor_whatsapp' => [
'nullable',
'regex:/^(03[0-9]{9}|\+923[0-9]{9})$/'
],
'donor_ref_name' => 'nullable|string|max:255',
'donor_whatsapp_sec' => [
'nullable',
'regex:/^(03[0-9]{9}|\+923[0-9]{9})$/'
],
];
}
public function messages(): array
{
return [
'donor_name.required' => 'Donor name is required.',
'donor_name.min' => 'Donor name must be at least 3 characters.',
'donor_whatsapp.regex' => 'Enter a valid WhatsApp number (e.g. 03XXXXXXXXX or +923XXXXXXXXX).',
'donor_whatsapp_sec.regex' => 'Enter a valid second WhatsApp number (e.g. 03XXXXXXXXX or +923XXXXXXXXX).',
];
}
}