Level 75
You can use unique for that
https://laravel.com/docs/7.x/collections#method-unique
$unique = $collection->unique(function ($item) {
return $item->a . $item->b;
});
How to remove duplicate values while selecting from table in database.
[ { A: "test", B: "test1" }, { A: "test1", B: "test" }, { A: "test2", B: "test1" }, { A: "test2", B: "test" } ]
Please or to participate in this conversation.