DONE: layout letter with letterhead and footer, notification for newly...
This commit is contained in:
@@ -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.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user