We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 6 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public static function getValidationRules(SmartCollectionInterface $attributes): array |
||
16 | { |
||
17 | return [ |
||
18 | 'required', |
||
19 | function ($attribute, $value, $fail) use ($attributes) { |
||
20 | if ($attributes->hasAttribute('entity') && $attributes->getAttributeValue('entity')) { |
||
21 | if (! is_string($value)) { |
||
22 | $fail('The '.$attribute.' should be a valid model string.'); |
||
23 | } |
||
24 | |||
25 | if (! is_a($value, 'Illuminate\Database\Eloquent\Model', true)) { |
||
26 | $fail('The '.$attribute.' should be a valid class that extends Illuminate\Database\Eloquent\Model .'); |
||
27 | } |
||
28 | } else { |
||
29 | if ($value !== false) { |
||
30 | $fail('The '.$attribute.' should be either false or a valid class that extends Illuminate\Database\Eloquent\Model.'); |
||
31 | } |
||
42 |