Not exactly what you asked for but this will make sure you get the data you need
$rules['category_id'] = 'required';
$rules['input_name'] = 'required_if:category_id,0';
The way I usually handle this kind of thing is with javascript - I only show the $input_name field when the $category_id is set to 0. When $category_id is set to anything else I clear $input_name and hide the $input_name field. In the event that JS is disabled I just set $input_name to null on save when $category_id = 0
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community