mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-24 23:13:59 +00:00
66 lines
2.2 KiB
PHP
66 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Standards\Validators;
|
|
|
|
use App\Classes\General\Abstracts\AbstractValidation;
|
|
use App\Classes\Modules\Companies\DataTransferObjects\CompanyInfoObject;
|
|
|
|
class CompanyInfoValidation extends AbstractValidation
|
|
{
|
|
/**
|
|
* @param CompanyInfoObject $object
|
|
* @return array
|
|
*/
|
|
protected function data($object): array
|
|
{
|
|
return [
|
|
'company_id' => $object->getCompany()->id,
|
|
'unified_social_credit_identifier' => $object->getUnifiedSocialCreditIdentifier(),
|
|
'business_registration_number' => $object->getBusinessRegistrationNumber(),
|
|
'type' => $object->getType(),
|
|
'legal_representative' => $object->getLegalRepresentative(),
|
|
'last_year_of_inspection' => $object->getLastYearInspection(),
|
|
'date_of_establishment' => $object->getDateOfEstablishment(),
|
|
'operation_period' => $object->getOperationPeriod()
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param string $type
|
|
* @return array
|
|
*/
|
|
protected function rules(?string $type = 'POST'): array
|
|
{
|
|
if ($type == 'POST') {
|
|
return [
|
|
'company_id' => 'required',
|
|
'unified_social_credit_identifier' => 'required',
|
|
'business_registration_number' => 'required',
|
|
'type' => 'required',
|
|
'legal_representative' => 'required',
|
|
'last_year_of_inspection' => 'required',
|
|
'date_of_establishment' => 'required|date',
|
|
'operation_period' => 'required'
|
|
];
|
|
}
|
|
elseif($type == 'PUT') {
|
|
return [
|
|
'unified_social_credit_identifier' => 'required',
|
|
'business_registration_number' => 'required',
|
|
'type' => 'required',
|
|
'legal_representative' => 'required',
|
|
'last_year_of_inspection' => 'required',
|
|
'date_of_establishment' => 'required|date',
|
|
'operation_period' => 'required'
|
|
];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function messages(): array
|
|
{
|
|
return [];
|
|
}
|
|
} |