In my application, have a form that could (theoretically) have infinite task and I want to define a validation rule in my Request that checks that none of them is equals to each others:
From:
<select name="task[1][id][]" class="form-control">
..
<select name="task[2][id][]" class="form-control">
..
..
<select name="task[n][id][]" class="form-control">
Since I am still not familiar enough with Laravel validations, I was naiv and tried things like:
'task[1][id][]' => 'different:task[2][id][]', 'task[2][id][]' => 'different:task[1][id][]'
or:
'task[1][id][*]' => 'different:task[2][id][*]', 'task[2][id][*]' => 'different:task[1][id][*]'
or:
'task[*][id][*]' => 'different:task[*][id][*]'
I do not get any error, but the validation always passes. I am pretty sure, that there is a good way to get this thing running, but I think that I am on the wrong way..
edit: (additional information as requested)
<select name="task[1][id][]" class="form-control">
<option value=""> </option>
@foreach ($users as $user)
<option value="{{ $user->id }}">{{ $user->email }}</option>
@endforeach
</select>
<select name="task[2][id][]" class="form-control">
<option value=""> </option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->email }}</option>
@endforeach
</select>
For now, I am using "hardcoded" <select>. Nothing special...