I am working on a Laravel 5.2 project and I intend to validate a drop down of my categories in a post. All Post should have a category and the default displayed option should not be accepted.
Here's what my select form looks like
<div class="form-group">
{!! Form::label('category_name','Category:') !!}
{!! Form::select('category_name',$categories,"",['class'=>'form-control']) !!}
</div>
My validation rules
public function rules()
{
return [
'title'=>'required',
'body'=>'required',
'category'=>'required|not_in:1'
];
}
}
Also heres my table data
<td></td>
Yet I am getting this error,the "category field is required".Even though I chose other categories or leave it at default. Kindy help.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2iKensy
via IFTTT
Aucun commentaire:
Enregistrer un commentaire