Laravel array validation unique values

Laravel now have ability to check if validation array have only unique values.

It’s very helpful if you want to ensure that user enters only unique values.

In this example we ensure that user create tasks with different titles.

        $validator = Validator::make($request->all(), [
            'task.*.title' => 'required|distinct',
            'task.*.body' => 'required',
        ]);

        if ($validator->fails()) {
            return redirect('task/create')
                        ->withErrors($validator)
                        ->withInput();
        }

More at documentation:
Laravel Validation Distinct values

Laravel array validation unique values