mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Standards\Validators;
|
|
|
|
use App\Classes\General\Abstracts\AbstractValidation;
|
|
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
|
|
|
class CompanyValidation extends AbstractValidation
|
|
{
|
|
/**
|
|
* @param CompanyObject $object
|
|
* @return array
|
|
*/
|
|
protected function data($object): array
|
|
{
|
|
return [
|
|
'company_name' => $object->getName(),
|
|
'company_reference' => $object->getReference(),
|
|
'type' => $object->getBusinessType()
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param string $type
|
|
* @return array
|
|
*/
|
|
protected function rules(?string $type = 'POST'): array
|
|
{
|
|
if ($type == 'POST') {
|
|
return [
|
|
'company_name' => 'required',
|
|
'company_reference' => '',
|
|
'type' => ''
|
|
];
|
|
}
|
|
elseif($type == 'PUT') {
|
|
return [
|
|
'type' => 'required'
|
|
];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function messages(): array
|
|
{
|
|
return [];
|
|
}
|
|
} |