$collection = collect([
['product_id' => '100', 'name' => 'Desk'],
['product_id' => '200', 'name' => 'Chair'],
]);
//1. delete using filter, return only product_id not equal to 200, we filter unwanted data
$collection = $collection->filter(function($item) {
return $item->product_id != '200';
});
//2. delete by id
$collection = collect([
['product_id' => '100', 'name' => 'Desk'],
['product_id' => '200', 'name' => 'Chair'],
]);
$keyed = $collection->keyBy('product_id');
/*
[
'100' => ['product_id' => '100', 'name' => 'Desk'],
'200' => ['product_id' => '200', 'name' => 'Chair'],
]
*/
//remove item with key 200
$keyed->forget(200);