Laravel - Collections - Method Reject
The reject
method filters the collection using the given closure. The closure should return true
if the item should be removed from the resulting collection:
$collection = collect([1, 2, 3, 4]);
$filtered = $collection->reject(function ($value, $key) {
return $value > 2;
});
$filtered->all();
// [1, 2]
For the inverse of the reject
method, see the filter
method.