mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
1dfb75545f
Fetch Currency Rate Logic Class Create Currency Rate Logic Class Update Currency Rate Logic Class Currency Rate Converter Rate
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\CurrencyRates\Standards\Rules;
|
|
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\CurrencyRates\DataTransferObjects\SegmentObject;
|
|
use App\Classes\Modules\CurrencyRates\Standards\Validators\CurrencyRateValidation;
|
|
|
|
class CanCreateCurrencyRate extends AbstractRule
|
|
{
|
|
|
|
/** @var CurrencyRateValidation */
|
|
private $currencyRateValidation;
|
|
|
|
/**
|
|
* CanCreateCurrencyRate constructor.
|
|
* @param CurrencyRateValidation $CurrencyRateValidation
|
|
*/
|
|
public function __construct(CurrencyRateValidation $currencyRateValidation)
|
|
{
|
|
$this->currencyRateValidation = $currencyRateValidation;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function authorized(): bool
|
|
{
|
|
// TODO Set Authorization rules
|
|
if (!\Auth::user()->can('add currency_rate')) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @param SegmentObject $object
|
|
* @return bool
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return $this->currencyRateValidation->validate($object, 'POST');
|
|
}
|
|
|
|
/**
|
|
* @param SegmentObject $object
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
return true;
|
|
}
|
|
} |