DONE: layout letter with letterhead and footer, notification for newly...
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class AddressRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// Get the address ID from the route (with null check)
|
||||
$addressId = $this->route() ? $this->route('address') : null;
|
||||
|
||||
// Check if this is a create or update operation
|
||||
$isCreate = $this->isMethod('POST');
|
||||
$isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
|
||||
|
||||
// If this is not a POST, PUT, or PATCH request, return minimal rules
|
||||
if (! $isCreate && ! $isUpdate) {
|
||||
return [
|
||||
'address_type' => 'nullable|string|max:255',
|
||||
'address_line_1' => 'nullable|string|max:255',
|
||||
'address_line_2' => 'nullable|string|max:255',
|
||||
'city' => 'nullable|string|max:255',
|
||||
'state' => 'nullable|string|max:255',
|
||||
'postcode' => 'nullable|string|max:255',
|
||||
'country' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
// Build unique email validation rule
|
||||
$addressUniqueRule = $addressId ? 'unique:addresses,address_type,'.$addressId : 'unique:addresses,address_type';
|
||||
|
||||
// If this is an update operation, make email and password optional
|
||||
if ($isUpdate) {
|
||||
return [
|
||||
'address_type' => 'required|string|max:255',
|
||||
'address_line_1' => 'required|string|max:255',
|
||||
'address_line_2' => 'nullable|string|max:255',
|
||||
'city' => 'required|string|max:255',
|
||||
'state' => 'required|string|max:255',
|
||||
'postcode' => 'required|string|max:255',
|
||||
'country' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
// Default rules for create operations
|
||||
return [
|
||||
'address_type' => 'required|string|max:255',
|
||||
'address_line_1' => 'required|string|max:255',
|
||||
'address_line_2' => 'nullable|string|max:255',
|
||||
'city' => 'required|string|max:255',
|
||||
'state' => 'required|string|max:255',
|
||||
'postcode' => 'required|string|max:255',
|
||||
'country' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'address_type.required' => 'Jenis alamat diperlukan.',
|
||||
'address_type.max' => 'Jenis alamat tidak boleh melebihi 255 aksara.',
|
||||
'address_line_1.max' => 'Alamat 1 tidak boleh melebihi 255 aksara.',
|
||||
'address_line_2.max' => 'Alamat 2 tidak boleh melebihi 255 aksara.',
|
||||
'city.max' => 'Bandar tidak boleh melebihi 255 aksara.',
|
||||
'state.max' => 'Negeri tidak boleh melebihi 255 aksara.',
|
||||
'postcode.max' => 'Poskod tidak boleh melebihi 255 aksara.',
|
||||
'country.max' => 'Negara tidak boleh melebihi 255 aksara.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BankDetailRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// Check if this is a create or update operation
|
||||
$isCreate = $this->isMethod('POST');
|
||||
$isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
|
||||
|
||||
// If this is not a POST, PUT, or PATCH request, return minimal rules
|
||||
if (! $isCreate && ! $isUpdate) {
|
||||
return [
|
||||
'bank_id' => 'nullable|string|max:255',
|
||||
'account_name' => 'nullable|string|max:255',
|
||||
'account_number' => 'nullable|string|max:255',
|
||||
'account_type' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
// Default rules for create and update operations
|
||||
return [
|
||||
'bank_id' => 'required|string|max:255',
|
||||
'account_name' => 'required|string|max:255',
|
||||
'account_number' => 'required|string|max:255',
|
||||
'account_type' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'bank_id.required' => 'ID bank diperlukan.',
|
||||
'bank_id.string' => 'ID bank tidak sah.',
|
||||
'bank_id.max' => 'ID bank tidak boleh melebihi 255 aksara.',
|
||||
'account_name.required' => 'Nama akaun diperlukan.',
|
||||
'account_name.string' => 'Nama akaun tidak sah.',
|
||||
'account_name.max' => 'Nama akaun tidak boleh melebihi 255 aksara.',
|
||||
'account_number.required' => 'Nombor akaun diperlukan.',
|
||||
'account_number.string' => 'Nombor akaun tidak sah.',
|
||||
'account_number.max' => 'Nombor akaun tidak boleh melebihi 255 aksara.',
|
||||
'account_type.required' => 'Jenis akaun diperlukan.',
|
||||
'account_type.string' => 'Jenis akaun tidak sah.',
|
||||
'account_type.max' => 'Jenis akaun tidak boleh melebihi 255 aksara.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BankRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// Check if this is a create or update operation
|
||||
$isCreate = $this->isMethod('POST');
|
||||
$isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
|
||||
|
||||
// If this is not a POST, PUT, or PATCH request, return minimal rules
|
||||
if (! $isCreate && ! $isUpdate) {
|
||||
return [
|
||||
'name' => 'nullable|string|max:255',
|
||||
'code' => 'nullable|string|max:255',
|
||||
'swift_code' => 'nullable|string|max:255',
|
||||
'is_active' => 'nullable|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// If this is an update operation, make email and password optional
|
||||
if ($isUpdate) {
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'code' => 'required|string|max:255',
|
||||
'swift_code' => 'nullable|string|max:255',
|
||||
'is_active' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// Default rules for create operations
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'code' => 'required|string|max:255',
|
||||
'swift_code' => 'nullable|string|max:255',
|
||||
'is_active' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Nama bank diperlukan.',
|
||||
'name.max' => 'Nama bank tidak boleh melebihi 255 aksara.',
|
||||
'code.required' => 'Kod bank diperlukan.',
|
||||
'code.max' => 'Kod bank tidak boleh melebihi 255 aksara.',
|
||||
'swift_code.max' => 'Swift code tidak boleh melebihi 255 aksara.',
|
||||
'is_active.required' => 'Status aktif diperlukan.',
|
||||
'is_active.boolean' => 'Status aktif tidak sah.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EmploymentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// Check if this is a create or update operation
|
||||
$isCreate = $this->isMethod('POST');
|
||||
$isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
|
||||
|
||||
// If this is not a POST, PUT, or PATCH request, return minimal rules
|
||||
if (! $isCreate && ! $isUpdate) {
|
||||
return [
|
||||
'company_name' => 'nullable|string|max:255',
|
||||
'job_title' => 'nullable|string|max:255',
|
||||
'employment_type' => 'nullable|string|max:255',
|
||||
'salary' => 'nullable|numeric|min:0',
|
||||
'start_date' => 'nullable|date',
|
||||
'end_date' => 'nullable|date',
|
||||
'is_current' => 'nullable|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// If this is an update operation, make email and password optional
|
||||
if ($isUpdate) {
|
||||
return [
|
||||
'company_name' => 'required|string|max:255',
|
||||
'job_title' => 'required|string|max:255',
|
||||
'employment_type' => 'required|string|max:255',
|
||||
'salary' => 'required|numeric|min:0',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'nullable|date',
|
||||
'is_current' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// Default rules for create operations
|
||||
return [
|
||||
'company_name' => 'required|string|max:255',
|
||||
'job_title' => 'required|string|max:255',
|
||||
'employment_type' => 'required|string|max:255',
|
||||
'salary' => 'required|numeric|min:0',
|
||||
'start_date' => 'required|date',
|
||||
'end_date' => 'nullable|date',
|
||||
'is_current' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'company_name.required' => 'Nama syarikat diperlukan.',
|
||||
'company_name.max' => 'Nama syarikat tidak boleh melebihi 255 aksara.',
|
||||
'job_title.required' => 'Jawatan diperlukan.',
|
||||
'job_title.max' => 'Jawatan tidak boleh melebihi 255 aksara.',
|
||||
'employment_type.required' => 'Jenis kerja diperlukan.',
|
||||
'employment_type.max' => 'Jenis kerja tidak boleh melebihi 255 aksara.',
|
||||
'salary.required' => 'Gaji diperlukan.',
|
||||
'salary.numeric' => 'Gaji tidak sah.',
|
||||
'salary.min' => 'Gaji tidak boleh kurang dari 0.',
|
||||
'start_date.required' => 'Tarikh mulai kerja diperlukan.',
|
||||
'start_date.date' => 'Tarikh mulai kerja tidak sah.',
|
||||
'end_date.date' => 'Tarikh akhir kerja tidak sah.',
|
||||
'is_current.required' => 'Status kerja saat ini diperlukan.',
|
||||
'is_current.boolean' => 'Status kerja saat ini tidak sah.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\User\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class HeirRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
// Check if this is a create or update operation
|
||||
$isCreate = $this->isMethod('POST');
|
||||
$isUpdate = $this->isMethod('PUT') || $this->isMethod('PATCH');
|
||||
|
||||
// If this is not a POST, PUT, or PATCH request, return minimal rules
|
||||
if (! $isCreate && ! $isUpdate) {
|
||||
return [
|
||||
'name' => 'nullable|string|max:255',
|
||||
'ic_number' => 'nullable|string|max:255',
|
||||
'relationship' => 'nullable|string|max:255',
|
||||
'phone_number' => 'nullable|string|max:255',
|
||||
'address' => 'nullable|string',
|
||||
'is_primary' => 'nullable|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// If this is an update operation, make email and password optional
|
||||
if ($isUpdate) {
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'ic_number' => 'required|string|max:255',
|
||||
'relationship' => 'required|string|max:255',
|
||||
'phone_number' => 'required|string|max:255',
|
||||
'address' => 'required|string',
|
||||
'is_primary' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
// Default rules for create operations
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'ic_number' => 'required|string|max:255',
|
||||
'relationship' => 'required|string|max:255',
|
||||
'phone_number' => 'required|string|max:255',
|
||||
'address' => 'required|string',
|
||||
'is_primary' => 'required|boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => 'Nama diperlukan.',
|
||||
'name.max' => 'Nama tidak boleh melebihi 255 aksara.',
|
||||
'ic_number.required' => 'Nombor Kad Pengenalan diperlukan.',
|
||||
'ic_number.max' => 'Nombor Kad Pengenalan tidak boleh melebihi 255 aksara.',
|
||||
'relationship.required' => 'Hubungan diperlukan.',
|
||||
'relationship.max' => 'Hubungan tidak boleh melebihi 255 aksara.',
|
||||
'phone_number.required' => 'Nombor telefon diperlukan.',
|
||||
'phone_number.max' => 'Nombor telefon tidak boleh melebihi 255 aksara.',
|
||||
'address.required' => 'Alamat diperlukan.',
|
||||
'address.string' => 'Alamat tidak sah.',
|
||||
'is_primary.required' => 'Status pewaris utama diperlukan.',
|
||||
'is_primary.boolean' => 'Status pewaris utama tidak sah.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,13 @@ class UserRequest extends FormRequest
|
||||
'phone_number' => 'nullable|string|max:255',
|
||||
'image_url' => 'nullable|string|max:255',
|
||||
'status' => 'nullable|string',
|
||||
'gender' => 'nullable|string|max:255',
|
||||
'marriage_status' => 'nullable|string|max:255',
|
||||
'member_number' => 'required|integer',
|
||||
'member_type' => 'required|string|max:255',
|
||||
'join_date' => 'nullable|date',
|
||||
'birth_date' => 'nullable|date',
|
||||
'birth_place' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -58,10 +65,17 @@ class UserRequest extends FormRequest
|
||||
// ],
|
||||
'password' => 'nullable|string|min:8',
|
||||
'ic_number' => 'required|string|max:255',
|
||||
'position' => 'required|string|max:255',
|
||||
'position' => 'nullable|string|max:255',
|
||||
'phone_number' => 'nullable|string|max:255',
|
||||
'image_url' => 'nullable|string|max:255',
|
||||
'status' => 'nullable|string',
|
||||
'gender' => 'nullable|string|max:255',
|
||||
'marriage_status' => 'nullable|string|max:255',
|
||||
'member_number' => 'required|integer',
|
||||
'member_type' => 'required|string|max:255',
|
||||
'join_date' => 'nullable|date',
|
||||
'birth_date' => 'nullable|date',
|
||||
'birth_place' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -81,6 +95,13 @@ class UserRequest extends FormRequest
|
||||
'phone_number' => 'nullable|string|max:255',
|
||||
'image_url' => 'nullable|string|max:255',
|
||||
'status' => 'required|string',
|
||||
'gender' => 'required|string|max:255',
|
||||
'marriage_status' => 'required|string|max:255',
|
||||
'member_number' => 'required|integer',
|
||||
'member_type' => 'required|string|max:255',
|
||||
'join_date' => 'required|date',
|
||||
'birth_date' => 'required|date',
|
||||
'birth_place' => 'required|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -105,6 +126,20 @@ class UserRequest extends FormRequest
|
||||
'image_url.max' => 'URL imej tidak boleh melebihi 255 aksara.',
|
||||
'status.required' => 'Status diperlukan.',
|
||||
'status.string' => 'Status aktif tidak sah.',
|
||||
'gender.required' => 'Jenis kelamin diperlukan.',
|
||||
'gender.max' => 'Jenis kelamin tidak boleh melebihi 255 aksara.',
|
||||
'marriage_status.required' => 'Status perkahwinan diperlukan.',
|
||||
'marriage_status.max' => 'Status perkahwinan tidak boleh melebihi 255 aksara.',
|
||||
'member_number.required' => 'Nombor anggota diperlukan.',
|
||||
'member_number.integer' => 'Nombor anggota tidak sah.',
|
||||
'member_type.required' => 'Jenis anggota diperlukan.',
|
||||
'member_type.max' => 'Jenis anggota tidak boleh melebihi 255 aksara.',
|
||||
'join_date.required' => 'Tarikh join diperlukan.',
|
||||
'join_date.date' => 'Tarikh join tidak sah.',
|
||||
'birth_date.required' => 'Tarikh lahir diperlukan.',
|
||||
'birth_date.date' => 'Tarikh lahir tidak sah.',
|
||||
'birth_place.required' => 'Tempat lahir diperlukan.',
|
||||
'birth_place.max' => 'Tempat lahir tidak boleh melebihi 255 aksara.',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user