mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-27 00:13:59 +00:00
a2381e44a7
Update Company Service Class Create Documents Service Class Create File Service Class Base64 File Convert Service Class File Upload Storage Service Class
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->getType()
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @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 [];
|
|
}
|
|
} |