mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Rewards\Standards\Rules;
|
|
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\Rewards\Standards\Validators\RewardValidation;
|
|
use App\Classes\Modules\Rewards\DataTransferObjects\RewardObject;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class CanCreateReward extends AbstractRule
|
|
{
|
|
|
|
/** @var RewardValidation */
|
|
private $rewardValidation;
|
|
|
|
/**
|
|
* CanCreateReward constructor.
|
|
* @param RewardValidation $rewardValidation
|
|
*/
|
|
public function __construct(RewardValidation $rewardValidation)
|
|
{
|
|
$this->rewardValidation = $rewardValidation;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function authorized($object): bool
|
|
{
|
|
if (!Auth::user()->can('add reward')) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @param RewardObject $object
|
|
* @return bool
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return true; // $this->rewardValidation->validate($object, 'POST');
|
|
}
|
|
|
|
/**
|
|
* @param RewardObject $object
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|