mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Segments\Standards\Rules;
|
|
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
|
use App\Classes\Modules\Segments\Standards\Validators\ConstantValidation;
|
|
|
|
class CanCreateConstant extends AbstractRule
|
|
{
|
|
|
|
/** @var ConstantValidation */
|
|
private $constantValidation;
|
|
|
|
/**
|
|
* CanCreateConstant constructor.
|
|
* @param ConstantValidation $constantValidation
|
|
*/
|
|
public function __construct(ConstantValidation $constantValidation)
|
|
{
|
|
$this->constantValidation = $constantValidation;
|
|
}
|
|
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function authorized(): bool
|
|
{
|
|
// TODO Set Authorization rules
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* @param ConstantObject $object
|
|
* @return bool
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return $this->constantValidation->validate($object, 'POST');
|
|
}
|
|
|
|
/**
|
|
* @param ConstantObject $object
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
return true;
|
|
}
|
|
} |