I have a form to create a new category :
{{ Form::open(['route' => ['category.store'], 'method' => 'POST']) }}
...
{{ Form::label('is_parent') }}
{{ Form::checkbox('is_parent') }}
{{ Form::label('parent_id') }}
{{ Form::select('parent_id', $categories) }}
{{ Form::submit('Create') }}
{{ Form::close() }}
The $categories array contains ['' => 'Not Selected] as first record followed by main categories.
My validation rules :
...
'parent_id' => 'required_without:is_parent|exists:categories,id,parent_id,null'
Now, when I hit a request with the is_parent selected, it should not check for exists rule.
But I still get an error saying : The selected parent id is invalid.
Also, the same is the case with unchecked.
Any idea what am I missing ?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community