$users = User::all(); $usersUnique = $users->unique(['user_name']); $userDuplicates = $users->diff($usersUnique); echo "<pre>"; print_r($userDuplicates->toArray());
add validation rule 'distinct'