Files
online.tbbank.gov.tm-larave…/app/Http/Controllers/Api/CardRequisite/Requests/CardRequisiteUpdateRequest.php
2025-06-19 19:33:15 +05:00

121 lines
3.5 KiB
PHP

<?php
namespace App\Http\Controllers\Api\CardRequisite\Requests;
use App\Modules\DateHelper\Repositories\DateHelperRepository;
use App\Repos\System\Settings\Legal\PassportRepo;
use App\Repos\System\Settings\Location\RegionRepo;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class CardRequisiteUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<int, string>|string>
*/
public function rules(): array
{
return [
/**
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
*/
'card_type_id' => ['sometimes', 'integer', Rule::exists('card_types', 'id')],
/**
* @example 9934612100000243
*/
'card_number' => ['sometimes', 'digits:16'],
/**
* @example 12
*/
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
/**
* @example 2049
*/
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
/**
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
*
* @example ag
*/
'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 10.10.2000
*/
'born_at' => ['sometimes', 'before_or_equal:today'],
/**
* Phone number
*
* @example 65999990
*/
'phone' => ['sometimes', 'integer', 'between:61000000, 71999999'],
/**
* Passport serie
*
* @example I-AS
*/
'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
/**
* @example 379514
*/
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
/**
* 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'],
];
}
}