mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Orders\Standards\Validators;
|
|
|
|
use App\Classes\General\Abstracts\AbstractValidation;
|
|
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class OrderRoleValidation extends AbstractValidation
|
|
{
|
|
/**
|
|
* @param OrderObject $object
|
|
* @return array
|
|
*/
|
|
protected function data($object): array
|
|
{
|
|
return [
|
|
'order_id' => $object->getOrderId(),
|
|
'company_module_id' => $object->getCompanyModuleId(),
|
|
'role_hash_id' => $object->getRoleHashId(),
|
|
'role_signature' => $object->getRoleSignature(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param string $type
|
|
* @return array
|
|
*/
|
|
protected function rules(?string $type = 'POST'): array
|
|
{
|
|
return [
|
|
'order_id' => ['required', Rule::exists('orders', 'id')],
|
|
'company_module_id' => ['required', Rule::exists('company_modules', 'id')],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
protected function messages(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|