Look at the "different" validation rule:
https://laravel.com/docs/5.6/validation#rule-different
Cheers
Edit: Or you might need the "distinct" rule:
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi!
I'm implementing a form with dynamic fields being added by an add field button. What I need is to prevent some of these fields to have the same value before submission.
Currently my Request rules look like this:
public function rules()
{
return [
'myfield.*.domain' => 'required|url',
'myfield.*.group' => 'required',
'myfield.*.client' => 'nullable'
];
}
For instance, what if want the domain input to be unique in the form submission (not the database)? Is this possible?
Any help would be really appreciated!
Thanks!
Look at the "different" validation rule:
https://laravel.com/docs/5.6/validation#rule-different
Cheers
Edit: Or you might need the "distinct" rule:
Please or to participate in this conversation.