adam78
adam78

Reputation: 10068

Laravel 5 array validation

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

Answers (1)

adam78
adam78

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

Related Questions