76 lines
3.3 KiB
PHP
76 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\DomainFluctuation\App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Modules\DomainFluctuation\App\DTOs\DomainFluctuationDTO;
|
|
|
|
class StoreDomainFluctuationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'domainName' => ['required', 'string', 'max:255'],
|
|
'term_id' => ['required', 'integer', 'exists:domain_fluctuation_terms,id'],
|
|
'ownerName' => ['required', 'string', 'max:255'],
|
|
'ownerType' => ['required', 'in:C,T'],
|
|
'address' => ['required', 'string'],
|
|
'countryCode' => ['required', 'string', 'max:10'],
|
|
'adminName' => ['required', 'string', 'max:255'],
|
|
'phone' => ['required', 'string', 'max:50'],
|
|
'email' => ['required', 'email', 'max:255'],
|
|
'registeredDate' => ['required'],
|
|
'expiredDate' => ['required'],
|
|
'cityName' => ['nullable', 'string', 'max:255'],
|
|
'cityCode' => ['nullable', 'string', 'max:50'],
|
|
'districtName' => ['nullable', 'string', 'max:255'],
|
|
'wardName' => ['nullable', 'string', 'max:255'],
|
|
'fax' => ['nullable', 'string', 'max:50'],
|
|
'icannRegistrarName' => ['nullable', 'string', 'max:255'],
|
|
'icannRegistrarTradeName' => ['nullable', 'string', 'max:255'],
|
|
'businessCode' => ['nullable', 'string', 'max:100'],
|
|
'eidCode' => ['nullable', 'string', 'max:100'],
|
|
'personalId' => ['nullable', 'string', 'max:50'],
|
|
'birthDate' => ['nullable', 'string', 'max:20'],
|
|
'isAgentManager' => ['nullable', 'boolean'],
|
|
'action' => ['nullable', 'string', 'max:100'],
|
|
'actionReason' => ['nullable', 'string'],
|
|
'actionSource' => ['nullable', 'string', 'max:100'],
|
|
'actionDate' => ['nullable'],
|
|
'note' => ['nullable', 'string'],
|
|
'ianaNumber' => ['nullable', 'integer'],
|
|
'status' => ['nullable', 'integer', 'in:0,1'],
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'domainName.required' => 'Tên miền là bắt buộc',
|
|
'term_id.required' => 'Đợt khai báo là bắt buộc',
|
|
'term_id.exists' => 'Đợt khai báo không tồn tại',
|
|
'ownerName.required' => 'Tên chủ sở hữu là bắt buộc',
|
|
'ownerType.required' => 'Loại chủ sở hữu là bắt buộc',
|
|
'ownerType.in' => 'Loại chủ sở hữu phải là C (cá nhân) hoặc T (tổ chức)',
|
|
'registeredDate.required' => 'Ngày đăng ký là bắt buộc',
|
|
'expiredDate.required' => 'Ngày hết hạn là bắt buộc',
|
|
'address.required' => 'Địa chỉ là bắt buộc',
|
|
'countryCode.required' => 'Mã quốc gia là bắt buộc',
|
|
'adminName.required' => 'Tên quản trị là bắt buộc',
|
|
'phone.required' => 'Số điện thoại là bắt buộc',
|
|
'email.required' => 'Email là bắt buộc',
|
|
'email.email' => 'Email không hợp lệ',
|
|
];
|
|
}
|
|
|
|
public function toDTO(): DomainFluctuationDTO
|
|
{
|
|
return DomainFluctuationDTO::fromArray($this->validated());
|
|
}
|
|
}
|