mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-28 17:04:18 +00:00
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Orders\Standards\Validators;
|
|
|
|
use App\Classes\General\Abstracts\AbstractValidation;
|
|
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
|
|
|
class OrderValidation extends AbstractValidation
|
|
{
|
|
/**
|
|
* @param OrderObject $object
|
|
* @return array
|
|
*/
|
|
protected function data($object): array
|
|
{
|
|
return [
|
|
'company_module_id' => $object->getCompanyModuleId(),
|
|
'reference' => $object->getReference(),
|
|
'reference_contract' => $object->getReferenceContract(),
|
|
'warehouse_id' => $object->getWarehouseId(),
|
|
'address_id' => $object->getAddressId(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param string $type
|
|
* @return array
|
|
*/
|
|
protected function rules(?string $type = 'POST'): array
|
|
{
|
|
if ($type == 'POST') {
|
|
return [
|
|
'company_module_id' => 'required',
|
|
'warehouse_id'=>'required',
|
|
'address_id'=>'required',
|
|
'reference' => '',
|
|
'reference_contract' => ''
|
|
];
|
|
} elseif ($type == 'PUT') {
|
|
return [
|
|
'id' => 'required'
|
|
];
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function messages(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|