Reputation: 10068
In laravel 5 how do i validate an array to check if at least one value is selected - the following doesn't work?
'user_list[]' => 'array|min:1',
{{ Form::select('user_list[]', $users, null , ['multiple' => 'multiple']) }}
Upvotes: 2
Views: 1110
Reputation: 10068
fixed by changing the field name in the rules array as follows and by adding a required rule:
'user_list' => 'required|array|min:1',
{{ Form::select('user_list[]', $users, null , ['multiple' => 'multiple']) }}
Upvotes: 5