| 12345678910111213141516171819202122232425262728 |
- <?php
- namespace App\Module\Fund\Validators;
- use App\Module\Fund\Services\FundService;
- use UCore\Validator;
- class UserFundCheckValidator extends Validator
- {
- public function validate(mixed $value, array $data): bool
- {
- if($value < 0 ) {
- return false;
- }
- $user_id = $this->args[0];
- $fund_id = $this->args[1];
- $fund = new FundService($user_id, $fund_id);
- if ($fund->balance() < $value) {
- return false;
- }
- return true;
- }
- }
|