I want to remove duplicated value between 2 arrays. How can I do?
- 1, 3, 4, 6 are duplicated in a both arrays, I want to unique values.
I using map() to show arrays of item_id contains of quantity but it's duplicate value, I don't want it.
$deliveries = $pickupsGroupByDepartment->first()->map(function ($q) {
return $q->deliveries->groupBy('delivery_date')->map(function($r) {
return $r->mapToGroups(function ($item) {
return [$item['item_id'] => $item['quantity']];
});
});
});
