You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So depending on if required is before or after exclude_if the validator fails or won't. Laravel data first always adds required/nullable rules, then type rules and then attribute rules which causes this bug.
The easiest solution would be to write a custom rules method and overwrite the rule.
Also small thing: Exclude isn't going to exclude in laravel data since we don't use the validated payload, something we're going to fix in v5 but this is not the case right now. It might be better to use RequiredWith rules which do work as expected.
✏️ Describe the bug
I'm using ExcludeIf in attributes (see example below). When I have $type = 'user' I still have company_id as required...
↪️ To Reproduce
Provide us a pest test like this one which shows the problem:
✅ Expected behavior
The $company_id should not be required
🖥️ Versions
Laravel: 11.22.0
Laravel Data: 4.8.2
PHP: 8.3.6
The text was updated successfully, but these errors were encountered: