Closed scippio closed 1 month ago
I think it's same as https://github.com/spatie/laravel-data/issues/844
@scippio i feel the combination of the sometimes
(in this case Optional) and required_with
rules creates a conflict.
Yes.
@scippio What I meant to say is your data class validation doesn't work because of the Optional type for both properties which translates to "sometimes". notice how the rules method work.
So it's a laravel-data bug? Because Laravel works as expected.
Duplicate indeed, fixed in next release!
✏️ Describe the bug I think there is a bad behaviour with RequiredWith attribute.
↪️ To Reproduce¨
✅ Expected behavior I think there should be validate error like: "The city field is required when street is present.", but the request is accepted. The "rules" function with "required_with" works as expected.
🖥️ Versions
Laravel: 11 Laravel Data: 4.6.0 PHP: 8.3.6