|string> */ public function rules(): array { return [ /** * Loan type id (https://online.tbbank.gov.tm/api/loan-types) */ 'loan_type' => ['sometimes', 'integer', Rule::exists('loan_types', 'id')], /** * Loan amount * * @example 20000 */ 'loan_amount' => ['sometimes', 'integer', 'max:40000'], /** * Region (https://online.tbbank.gov.tm/api/base-app-enums) */ 'region' => ['sometimes', 'string', Rule::in(array_keys(RegionRepo::values()))], /** * Branch id (https://online.tbbank.gov.tm/api/branches) */ 'branch_id' => ['sometimes', 'integer', Rule::exists('branches', 'id')], /** * Customer name * * @example Mahmyt */ 'customer_name' => ['sometimes', 'string', 'max:255'], /** * Customer surname * * @example Allaberdiyev */ 'customer_surname' => ['sometimes', 'string', 'max:255'], /** * Customer patronic name * * @example Öwezowiç */ 'customer_patronic_name' => ['nullable', 'string', 'max:255'], /** * Date of birth * * @example 2000 */ 'born_at' => ['sometimes', 'before_or_equal:today'], /** * Education (https://online.tbbank.gov.tm/api/base-app-enums) */ 'education' => ['sometimes', 'string', Rule::in(array_keys(EducationRepo::values()))], /** * Marriage status (https://online.tbbank.gov.tm/api/base-app-enums) */ 'marriage_status' => ['sometimes', 'string', Rule::in(array_keys(MarriageRepo::values()))], /** * Passport address * * @example Kemine 100/190 */ 'passport_address' => ['sometimes', 'string', 'max:255'], /** * Real address * * @example Kemine 100/200 */ 'real_address' => ['sometimes', 'string', 'max:255'], /** * Passport serie */ 'passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())], /** * Passport number * * @example 100999 */ 'passport_id' => ['sometimes', 'numeric', 'digits:6'], /** * Passport date of issue * * @example 2024-01-10 */ 'passport_given_at' => ['sometimes', 'date', 'before_or_equal:today'], /** * Passport given by * * @example Ashgabat shaher polisiya tarapyndan */ 'passport_given_by' => ['sometimes', 'string', 'max:255'], /** * Born place * * @example Ashgabat shaher */ 'born_place' => ['sometimes', 'string', 'max:255'], /** * Email * * @example mahmyt1206@gmail.com */ 'email' => ['nullable', 'email', 'max:255'], /** * Phone number * * @example 65999990 */ 'phone' => ['sometimes', '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' => ['sometimes', 'string', 'max:255'], /** * Card number * * @example 4434345434423442 */ 'card_number' => ['sometimes', 'digits:16'], /** * Name on card * * @example 'Mahmyt Allaberdiyev' */ 'card_name' => ['sometimes', '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' => ['sometimes', 'string', Rule::in(array_keys(RegionRepo::values()))], /** * Provinces (https://online.tbbank.gov.tm/api/provinces) */ 'work_province_id' => ['sometimes', 'integer', Rule::exists('provinces', 'id')], /** * Work company name * * @example WebUglam HJ */ 'work_company' => ['sometimes', 'string', 'max:255'], /** * HR department number * * @example 707012 */ 'work_company_accountant_number' => ['sometimes', 'string', 'max:255'], /** * Work position * * @example Bugalter */ 'work_position' => ['sometimes', 'string', 'max:255'], /** * Salary * * @example 40000 */ 'work_salary' => ['sometimes', 'numeric', 'max_digits:8'], /** * Work start date * * @example 2024-01-16 */ 'work_started_at' => ['sometimes', 'date', 'before_or_equal:today'], /** * Passport (sahypa 1) */ 'passport_one' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'], /** * Pasport (2-3-nji sahypa) */ 'passport_two' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'], /** * Pasport (8-9 sahypa) */ 'passport_three' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'], /** * Pasport (32-nji sahypa) */ 'passport_four' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'], /** * Guarantor name * * @example Mahmyt */ 'guarantor_name' => ['sometimes', 'string', 'max:255'], /** * Guarantor surname * * @example Allaberdiev */ 'guarantor_surname' => ['sometimes', 'string', 'max:255'], /** * Guarantor surname * * @example Owezowic */ 'guarantor_patronic_name' => ['sometimes', 'string', 'max:255'], /** * Guarantor card number * * @example 4323344234423443 */ 'guarantor_card_number' => ['sometimes', 'string', 'digits:16'], /** * Guarantor name on card * * @example Mahmyt Allaberdiyev */ 'guarantor_card_name' => ['sometimes', 'string', 'max:255'], /** * Guarantor Card month * * @example 06 */ 'guarantor_card_month' => ['sometimes', 'string'], /** * Guarantor Card year * * @example 2040 */ 'guarantor_card_year' => ['sometimes', 'string'], /** * Guarantor Passport serie * * @example I-AS */ 'guarantor_passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())], /** * Guarantor Passport number * * @example 100999 */ 'guarantor_passport_id' => ['sometimes', 'numeric', 'digits:6'], /** * 2. Guarantor name * * @example Mahmyt */ 'guarantor_2_name' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string', 'max:255'], /** * 2. Guarantor surname * * @example Allaberdiev */ 'guarantor_2_surname' => [Rule::requiredIf($this->input('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->input('loan_amount') > 20000), 'string', 'digits:16'], /** * 2. Guarantor name on card * * @example Mahmyt Allaberdiyev */ 'guarantor_2_card_name' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string'], /** * 2. Guarantor Card month * * @example 06 */ 'guarantor_2_card_month' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string'], /** * 2. Guarantor Card year * * @example 2040 */ 'guarantor_2_card_year' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string'], /** * Guarantor Passport serie * * @example I-AS */ 'guarantor_2_passport_serie' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string', Rule::in(PassportRepo::values())], /** * Guarantor Passport number * * @example 100999 */ 'guarantor_2_passport_id' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'numeric', 'digits:6'], ]; } }