laravel collection no duplicates code example
Example 1: laravel collection remove duplicates
$unique = $collection->unique();
Example 2: laravel collection find duplicates
$users = Users::all();
$usersUnique = $users->unique('id');
$usersDupes = $users->diff($usersUnique);
dd($users, $usersUnique, $usersDupes);