Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kinsflow's avatar

How to validate using rule `present` when another node is of a particular value in laravel

so I have this issue I am faced with since a while now.

i have a validation rule that is like this

'editors' => ['required_if:type,journal', 'array', 'min:1'], but I want to change the validation to accept an empty array but I want that field to be present if type=journal.. but I seem not to know how to go about it.. I will appreciate any assistance. thanks

0 likes
1 reply

Please or to participate in this conversation.