Answers for "laravel collection reject"

PHP
0

laravel collection reject

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

$filtered = $collection->reject(function ($value, $key) {
    return $value > 2;
});

$filtered->all();

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

Browse Popular Code Answers by Language