mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-30 18:03:59 +00:00
dec78bf8d7
Update Currency Selling Logic Class Delete Currency Selling Logic Class Create Currency Log Service Class
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Currencies\Standards\Rules;
|
|
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\Currencies\DataTransferObjects\SegmentObject;
|
|
use App\Classes\Modules\Currencies\Standards\Validators\CurrencyValidation;
|
|
|
|
class CanCreateCurrency extends AbstractRule
|
|
{
|
|
|
|
/** @var currencyValidation */
|
|
private $currencyValidation;
|
|
|
|
/**
|
|
* CanCreateCurrency constructor.
|
|
* @param CurrencyValidation $currencyValidation
|
|
*/
|
|
public function __construct(CurrencyValidation $currencyValidation)
|
|
{
|
|
$this->currencyValidation = $currencyValidation;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function authorized(): bool
|
|
{
|
|
// TODO Set Authorization rules
|
|
if (!\Auth::user()->can('add currency')) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @param SegmentObject $object
|
|
* @return bool
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return $this->currencyValidation->validate($object);
|
|
}
|
|
|
|
/**
|
|
* @param SegmentObject $object
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
return true;
|
|
}
|
|
} |