Answers for "laravel collection distinct vs unique"

PHP
8

select distinct laravel

$items = DB::table('item')->select('item_name')->distinct()->get();
Posted by: Guest on June-30-2020
0

laravel collection unique

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

$unique = $collection->unique();

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

// [1, 2, 3, 4]
Posted by: Guest on July-24-2021

Code answers related to "laravel collection distinct vs unique"

Browse Popular Code Answers by Language