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\Contacts\Standards\Rules;
|
|
|
|
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
|
use App\Classes\Modules\Contacts\Standards\Validators\ContactValidation;
|
|
|
|
class CanCreateContact extends AbstractRule
|
|
{
|
|
|
|
/** @var ContactValidation */
|
|
private $contactValidation;
|
|
|
|
|
|
/**
|
|
* CanCreateContact constructor.
|
|
* @param ContactValidation $contactValidation
|
|
*/
|
|
public function __construct(ContactValidation $contactValidation)
|
|
{
|
|
$this->contactValidation = $contactValidation;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function authorized(): bool
|
|
{
|
|
// TODO Set Authorization rules
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @param ContactObject $object
|
|
* @return bool
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return $this->contactValidation->validate($object);
|
|
}
|
|
|
|
/**
|
|
* @param ContactObject $object
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
} |