95 lines
4.6 KiB
PHP
95 lines
4.6 KiB
PHP
<?php
|
|
|
|
namespace Modules\MembershipApplication\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreMembershipApplicationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'applicant.name' => 'required|string|max:255',
|
|
'applicant.email' => 'required|email|max:255',
|
|
'applicant.ic_number' => 'required|string|max:20',
|
|
'applicant.birth_date' => 'required|date',
|
|
'applicant.birth_place' => 'required|string|max:255',
|
|
'applicant.gender' => ['required', Rule::in(['Lelaki', 'Perempuan'])],
|
|
'applicant.marriage_status' => 'required|string|max:255',
|
|
'applicant.address' => 'required|string',
|
|
'applicant.phone_number' => 'required|string|max:20',
|
|
'applicant.office_number' => 'nullable|string|max:20',
|
|
'applicant.postcode' => 'required|string|max:10',
|
|
'applicant.employer_name' => 'required|string|max:255',
|
|
'applicant.employer_address' => 'required|string',
|
|
'applicant.current_position' => 'required|string|max:255',
|
|
'applicant.start_work_date' => 'required|date',
|
|
'applicant.stock_monthly_contribution' => 'required|numeric|min:0',
|
|
'applicant.fee_monthly_contribution' => 'required|numeric|min:0',
|
|
|
|
'heirs' => 'required|array|min:1',
|
|
'heirs.*.name' => 'required|string|max:255',
|
|
'heirs.*.ic_number' => 'required|string|max:20',
|
|
'heirs.*.relationship' => 'required|string|max:255',
|
|
'heirs.*.phone_number' => 'required|string|max:20',
|
|
|
|
'references.proposer_ic_number' => 'nullable|string|max:20',
|
|
'references.supporter_ic_number' => 'nullable|string|max:20',
|
|
|
|
'documents.ic_copy' => 'required|file|mimes:pdf,jpg,jpeg,png|max:10240',
|
|
'documents.photo' => 'nullable|file|mimes:jpg,jpeg,png|max:10240',
|
|
'documents.salary_slip' => 'nullable|file|mimes:pdf,jpg,jpeg,png|max:10240',
|
|
'documents.employer_letter' => 'nullable|file|mimes:pdf,jpg,jpeg,png|max:10240',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'applicant.name.required' => 'Nama penuh diperlukan.',
|
|
'applicant.email.required' => 'Emel diperlukan.',
|
|
'applicant.email.email' => 'Emel tidak sah.',
|
|
'applicant.ic_number.required' => 'Nombor kad pengenalan diperlukan.',
|
|
'applicant.birth_date.required' => 'Tarikh lahir diperlukan.',
|
|
'applicant.birth_place.required' => 'Tempat lahir diperlukan.',
|
|
'applicant.gender.required' => 'Jantina diperlukan.',
|
|
'applicant.gender.in' => 'Jantina tidak sah.',
|
|
'applicant.marriage_status.required' => 'Status perkahwinan diperlukan.',
|
|
'applicant.address.required' => 'Alamat diperlukan.',
|
|
'applicant.phone_number.required' => 'Nombor telefon diperlukan.',
|
|
'applicant.postcode.required' => 'Poskod diperlukan.',
|
|
'applicant.employer_name.required' => 'Nama majikan diperlukan.',
|
|
'applicant.employer_address.required' => 'Alamat majikan diperlukan.',
|
|
'applicant.current_position.required' => 'Jawatan semasa diperlukan.',
|
|
'applicant.start_work_date.required' => 'Tarikh mula berkhidmat diperlukan.',
|
|
'applicant.stock_monthly_contribution.required' => 'Caruman saham bulanan diperlukan.',
|
|
'applicant.fee_monthly_contribution.required' => 'Caruman yuran bulanan diperlukan.',
|
|
|
|
'heirs.required' => 'Maklumat waris diperlukan.',
|
|
'heirs.min' => 'Sekurang-kurangnya satu waris diperlukan.',
|
|
'heirs.*.name.required' => 'Nama waris diperlukan.',
|
|
'heirs.*.ic_number.required' => 'Nombor kad pengenalan waris diperlukan.',
|
|
'heirs.*.relationship.required' => 'Hubungan waris diperlukan.',
|
|
'heirs.*.phone_number.required' => 'Nombor telefon waris diperlukan.',
|
|
|
|
'references.proposer_ic_number.max' => 'Nombor kad pengenalan pencadang tidak sah.',
|
|
'references.supporter_ic_number.max' => 'Nombor kad pengenalan penyokong tidak sah.',
|
|
|
|
'documents.ic_copy.required' => 'Salinan kad pengenalan diperlukan.',
|
|
'documents.ic_copy.mimes' => 'Salinan kad pengenalan mestilah PDF, JPG, JPEG atau PNG.',
|
|
];
|
|
}
|
|
}
|