dimtrovich /
validation
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of Dimtrovich/Validation. |
||
| 5 | * |
||
| 6 | * (c) 2023 Dimitri Sitchet Tomkeu <[email protected]> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view |
||
| 9 | * the LICENSE file that was distributed with this source code. |
||
| 10 | */ |
||
| 11 | |||
| 12 | namespace Dimtrovich\Validation\Rules; |
||
| 13 | |||
| 14 | use BlitzPHP\Utilities\Iterable\Arr; |
||
| 15 | use BlitzPHP\Utilities\Support\Invader; |
||
| 16 | use Rakit\Validation\Rule as RakitRule; |
||
| 17 | |||
| 18 | class MissingWith extends Missing |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * {@inheritDoc} |
||
| 22 | */ |
||
| 23 | public function fillParameters(array $params): RakitRule |
||
| 24 | { |
||
| 25 | $this->params['fields'] = $params; |
||
| 26 | |||
| 27 | return $this; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * {@inheritDoc} |
||
| 32 | */ |
||
| 33 | public function check($value): bool |
||
| 34 | { |
||
| 35 | $this->requireParameters(['fields']); |
||
| 36 | |||
| 37 | $fields = $this->parameter('fields'); |
||
| 38 | $inputs = Invader::make($this->validation)->inputs; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 39 | |||
| 40 | if (Arr::hasAny($inputs, $fields)) { |
||
| 41 | return parent::check($value); |
||
| 42 | } |
||
| 43 | |||
| 44 | return true; |
||
| 45 | } |
||
| 46 | } |
||
| 47 |