406 lines
11 KiB
PHP
406 lines
11 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\LoanOrder\Controllers\Requests;
|
|
|
|
use App\Repos\System\Settings\Legal\EducationRepo;
|
|
use App\Repos\System\Settings\Legal\MarriageRepo;
|
|
use App\Repos\System\Settings\Legal\PassportRepo;
|
|
use App\Repos\System\Settings\Location\RegionRepo;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class LoanOrderStoreRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
/**
|
|
* Loan type id (https://online.tbbank.gov.tm/api/loan-types)
|
|
*/
|
|
'loan_type' => ['required', 'integer', Rule::exists('loan_types', 'id')],
|
|
|
|
/**
|
|
* Loan amount
|
|
*
|
|
* @example 20000
|
|
*/
|
|
'loan_amount' => ['required', 'integer', 'max:40000'],
|
|
|
|
/**
|
|
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
|
*/
|
|
'region' => ['required', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
|
|
|
/**
|
|
* Branch id (https://online.tbbank.gov.tm/api/branches)
|
|
*/
|
|
'branch_id' => ['required', 'integer', Rule::exists('branches', 'id')],
|
|
|
|
/**
|
|
* Customer name
|
|
*
|
|
* @example Mahmyt
|
|
*/
|
|
'customer_name' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Customer surname
|
|
*
|
|
* @example Allaberdiyev
|
|
*/
|
|
'customer_surname' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Customer patronic name
|
|
*
|
|
* @example Öwezowiç
|
|
*/
|
|
'customer_patronic_name' => ['nullable', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Date of birth
|
|
*
|
|
* @example 2000
|
|
*/
|
|
'born_at' => ['required', 'before_or_equal:today'],
|
|
|
|
/**
|
|
* Education (https://online.tbbank.gov.tm/api/base-app-enums)
|
|
*/
|
|
'education' => ['required', 'string', Rule::in(array_keys(EducationRepo::values()))],
|
|
|
|
/**
|
|
* Marriage status (https://online.tbbank.gov.tm/api/base-app-enums)
|
|
*/
|
|
'marriage_status' => ['required', 'string', Rule::in(array_keys(MarriageRepo::values()))],
|
|
|
|
/**
|
|
* Passport address
|
|
*
|
|
* @example Kemine 100/190
|
|
*/
|
|
'passport_address' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Real address
|
|
*
|
|
* @example Kemine 100/200
|
|
*/
|
|
'real_address' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Passport serie
|
|
*/
|
|
'passport_serie' => ['required', 'string', Rule::in(PassportRepo::values())],
|
|
|
|
/**
|
|
* Passport number
|
|
*
|
|
* @example 100999
|
|
*/
|
|
'passport_id' => ['required', 'numeric', 'digits:6'],
|
|
|
|
/**
|
|
* Passport date of issue
|
|
*
|
|
* @example 2024-01-10
|
|
*/
|
|
'passport_given_at' => ['required', 'date', 'before_or_equal:today'],
|
|
|
|
/**
|
|
* Passport given by
|
|
*
|
|
* @example Ashgabat shaher polisiya tarapyndan
|
|
*/
|
|
'passport_given_by' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Born place
|
|
*
|
|
* @example Ashgabat shaher
|
|
*/
|
|
'born_place' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Email
|
|
*
|
|
* @example mahmyt1206@gmail.com
|
|
*/
|
|
'email' => ['nullable', 'email', 'max:255'],
|
|
|
|
/**
|
|
* Phone number
|
|
*
|
|
* @example 65999990
|
|
*/
|
|
'phone' => ['required', 'integer', 'between:61000000, 71999999'],
|
|
|
|
/**
|
|
* Phone number (additional)
|
|
*
|
|
* @example 61126667
|
|
*/
|
|
'phone_additional' => ['nullable', 'integer', 'between:61000000, 71999999'],
|
|
|
|
/**
|
|
* Phone number (home)
|
|
*
|
|
* @example 92-92-92
|
|
*/
|
|
'phone_home' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Card number
|
|
*
|
|
* @example 4434345434423442
|
|
*/
|
|
'card_number' => ['required', 'digits:16'],
|
|
|
|
/**
|
|
* Name on card
|
|
*
|
|
* @example 'Mahmyt Allaberdiyev'
|
|
*/
|
|
'card_name' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Card expiration month
|
|
*
|
|
* @example 06
|
|
*/
|
|
'card_month' => ['required'],
|
|
|
|
/**
|
|
* Card expiration year
|
|
*
|
|
* @example 2040
|
|
*/
|
|
'card_year' => ['required'],
|
|
|
|
/**
|
|
* Card number
|
|
*
|
|
* @example 4434345434423442
|
|
*/
|
|
'loan_card_number' => ['nullable', 'digits:16'],
|
|
|
|
/**
|
|
* Name on card
|
|
*
|
|
* @example 'Mahmyt Allaberdiyev'
|
|
*/
|
|
'loan_card_name' => ['nullable', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Card expiration month
|
|
*
|
|
* @example 06
|
|
*/
|
|
'loan_card_month' => ['nullable'],
|
|
|
|
/**
|
|
* Card expiration year
|
|
*
|
|
* @example 2040
|
|
*/
|
|
'loan_card_year' => ['nullable'],
|
|
|
|
/**
|
|
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
|
*/
|
|
'work_region' => ['required', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
|
|
|
/**
|
|
* Provinces (https://online.tbbank.gov.tm/api/provinces)
|
|
*/
|
|
'work_province_id' => ['required', 'integer', Rule::exists('provinces', 'id')],
|
|
|
|
/**
|
|
* Work company name
|
|
*
|
|
* @example WebUglam HJ
|
|
*/
|
|
'work_company' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* HR department number
|
|
*
|
|
* @example 707012
|
|
*/
|
|
'work_company_accountant_number' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Work position
|
|
*
|
|
* @example Bugalter
|
|
*/
|
|
'work_position' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Salary
|
|
*
|
|
* @example 40000
|
|
*/
|
|
'work_salary' => ['required', 'numeric', 'max_digits:8'],
|
|
|
|
/**
|
|
* Work start date
|
|
*
|
|
* @example 2024-01-16
|
|
*/
|
|
'work_started_at' => ['required', 'date', 'before_or_equal:today'],
|
|
|
|
/**
|
|
* Passport (sahypa 1)
|
|
*/
|
|
'passport_one' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
|
|
|
/**
|
|
* Pasport (2-3-nji sahypa)
|
|
*/
|
|
'passport_two' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
|
|
|
/**
|
|
* Pasport (8-9 sahypa)
|
|
*/
|
|
'passport_three' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
|
|
|
/**
|
|
* Pasport (32-nji sahypa)
|
|
*/
|
|
'passport_four' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
|
|
|
/**
|
|
* Guarantor name
|
|
*
|
|
* @example Mahmyt
|
|
*/
|
|
'guarantor_name' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Guarantor surname
|
|
*
|
|
* @example Allaberdiev
|
|
*/
|
|
'guarantor_surname' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Guarantor surname
|
|
*
|
|
* @example Owezowic
|
|
*/
|
|
'guarantor_patronic_name' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Guarantor card number
|
|
*
|
|
* @example 4323344234423443
|
|
*/
|
|
'guarantor_card_number' => ['required', 'string', 'digits:16'],
|
|
|
|
/**
|
|
* Guarantor name on card
|
|
*
|
|
* @example Mahmyt Allaberdiyev
|
|
*/
|
|
'guarantor_card_name' => ['required', 'string', 'max:255'],
|
|
|
|
/**
|
|
* Guarantor Card month
|
|
*
|
|
* @example 06
|
|
*/
|
|
'guarantor_card_month' => ['required', 'string'],
|
|
|
|
/**
|
|
* Guarantor Card year
|
|
*
|
|
* @example 2040
|
|
*/
|
|
'guarantor_card_year' => ['required', 'string'],
|
|
|
|
/**
|
|
* Guarantor Passport serie
|
|
*
|
|
* @example I-AS
|
|
*/
|
|
'guarantor_passport_serie' => ['required', 'string', Rule::in(PassportRepo::values())],
|
|
|
|
/**
|
|
* Guarantor Passport number
|
|
*
|
|
* @example 100999
|
|
*/
|
|
'guarantor_passport_id' => ['required', 'numeric', 'digits:6'],
|
|
|
|
/**
|
|
* 2. Guarantor name
|
|
*
|
|
* @example Mahmyt
|
|
*/
|
|
'guarantor_2_name' => [Rule::requiredIf($this->loan_amount > 20000), 'string', 'max:255'],
|
|
|
|
/**
|
|
* 2. Guarantor surname
|
|
*
|
|
* @example Allaberdiev
|
|
*/
|
|
'guarantor_2_surname' => [Rule::requiredIf($this->loan_amount > 20000), 'string', 'max:255'],
|
|
|
|
/**
|
|
* 2. Guarantor patronic name
|
|
*
|
|
* @example Owezowich
|
|
*/
|
|
'guarantor_2_patronic_name' => ['nullable', 'string', 'max:255'],
|
|
|
|
/**
|
|
* 2. Guarantor card number
|
|
*
|
|
* @example 4323344234423443
|
|
*/
|
|
'guarantor_2_card_number' => [Rule::requiredIf($this->loan_amount > 20000), 'string', 'digits:16'],
|
|
|
|
/**
|
|
* 2. Guarantor name on card
|
|
*
|
|
* @example Mahmyt Allaberdiyev
|
|
*/
|
|
'guarantor_2_card_name' => [Rule::requiredIf($this->loan_amount > 20000), 'string'],
|
|
|
|
/**
|
|
* 2. Guarantor Card month
|
|
*
|
|
* @example 06
|
|
*/
|
|
'guarantor_2_card_month' => [Rule::requiredIf($this->loan_amount > 20000), 'string'],
|
|
|
|
/**
|
|
* 2. Guarantor Card year
|
|
*
|
|
* @example 2040
|
|
*/
|
|
'guarantor_2_card_year' => [Rule::requiredIf($this->loan_amount > 20000), 'string'],
|
|
|
|
/**
|
|
* Guarantor Passport serie
|
|
*
|
|
* @example I-AS
|
|
*/
|
|
'guarantor_2_passport_serie' => ['required', 'string', Rule::in(PassportRepo::values())],
|
|
|
|
/**
|
|
* Guarantor Passport number
|
|
*
|
|
* @example 100999
|
|
*/
|
|
'guarantor_2_passport_id' => ['required', 'numeric', 'digits:6'],
|
|
];
|
|
}
|
|
}
|