laravel collection remove duplicates
snippet in php

laravel collection remove duplicates

user3208

$unique = $collection->unique();

laravel remove duplicates from array

user1256

$array = array(1, 2, 2, 3);
$array = array_unique($array); // Array is now (1, 2, 3)