2 years ago

required_if not working

Posted 2 years ago by almost_pitt

Hey guys,

Inside of my controller, I would like to require certain inputs if something is chosen.

For example, if the number of bedrooms is 2 or more, I would like the Furnished input for bedroom 2 to be required.

Here is the code that I have tried inside of my RoomsController.php:

            'Number_of_Bedrooms' => 'required',

            'Furnished_2' => 'required_if:Number_of_Bedrooms,2',

I have also tried,

            'Number_of_Bedrooms' => 'required',

            'Furnished_2' => 'required_if:Number_of_Bedrooms,==,2',

Note: Number_of_Bedrooms is a select input and the values go from 'Studio' to '1' to '6'

This, unfortunately, does not seem to wrok. I've looked at the documentation, but haven't been able to figure it out.

Can anyone help?


Please sign in or create an account to participate in this conversation.