mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\SegmentConstants\Standards\Validators;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractValidation;
|
|
use App\Classes\Modules\SegmentConstants\DataTransferObjects\SegmentConstantObject;
|
|
|
|
class SegmentConstantValidation extends AbstractValidation
|
|
{
|
|
/**
|
|
* @param SegmentConstantObject $object
|
|
* @return array
|
|
*/
|
|
protected function data($object): array {
|
|
|
|
$data = [
|
|
'segment_id'=> $object->getSegmentId(),
|
|
'name' => $object->getName(),
|
|
'reference' => $object->getReference(),
|
|
'type' => $object->getType(),
|
|
'detail' => $object->getDetail()
|
|
];
|
|
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function rules(?string $type = 'POST'): array {
|
|
return [
|
|
'segment_id' => $type == 'POST' ? 'required' : '',
|
|
'name' => 'required',
|
|
'reference' => 'required',
|
|
'type' => 'required',
|
|
'detail' => 'required'
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function messages(): array {
|
|
return [];
|
|
}
|
|
|
|
} |