Level 27
Maybe https://laravel.com/docs/8.x/validation#rule-exclude-unless is what you are looking for?
'editors' => 'exclude_unless:type,journal|present|array'
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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
Please or to participate in this conversation.