Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel collection unique

$collection = collect([1, 1, 2, 2, 3, 4, 2]);

$unique = $collection->unique();

$unique->values()->all();

// [1, 2, 3, 4]
Source by laravel.com #
 
PREVIOUS NEXT
Tagged: #laravel #collection #unique
ADD COMMENT
Topic
Name
1+4 =