mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 14:04:01 +00:00
30ed77f304
# Conflicts: # resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue # routes/api.php
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Affiliate\Standards\Rules;
|
|
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\Affiliate\DataTransferObjects\AffiliateObject;
|
|
use App\Classes\Modules\Affiliate\Standards\Validators\AffiliateCreateValidation;
|
|
|
|
class CanCreateAffiliate extends AbstractRule
|
|
{
|
|
/** @var AffiliateCreateValidation */
|
|
private $affiliateCreateValidation;
|
|
|
|
/**
|
|
* CanCreateAffiliate constructor.
|
|
* @param AffiliateCreateValidation $affiliateCreateValidation
|
|
*/
|
|
public function __construct(AffiliateCreateValidation $affiliateCreateValidation)
|
|
{
|
|
$this->affiliateCreateValidation = $affiliateCreateValidation;
|
|
}
|
|
|
|
/**
|
|
* @param AffiliateObject $object
|
|
* @return bool
|
|
*/
|
|
protected function authorized($object): bool
|
|
{
|
|
// Authorization is handled by policy in controller
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @param AffiliateObject $object
|
|
* @return bool
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return $this->affiliateCreateValidation->validate($object);
|
|
}
|
|
|
|
/**
|
|
* @param AffiliateObject $object
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
// No additional criteria needed for affiliate creation
|
|
return true;
|
|
}
|
|
}
|