Closed puggan closed 1 year ago
You mean add the ability to pass collection for the forget
method in Collection, like this:
$collection = collect([
'name' => 'taylor',
'framework' => 'laravel',
'age' => 18,
'job' => 'software engineer',
'frontend' => 'VueJS',
]);
$remColl = collect(['age', 'frontend']);
$collection->forget($remColl);
/*
"name" => "taylor"
"framework" => "laravel"
"job" => "software engineer"
/*
Why not use reject
?
$a = (new Collection([7 => ['c' => 9], 9 => ['c' => 2]]));
$filtered = $a->reject(function ($value) {
return $value['c'] > 8;
});
$filtered->all(); // [9 => ['c' => 2]]
Laravel Version
9.30.1
PHP Version
8.2.7
Database Driver & Version
No response
Description
Collection::forget not accepting Collection as parameter
https://github.com/laravel/framework/blob/aef89589ea70e0081c139b06550220cc75f20ea6/src/Illuminate/Collections/Collection.php#L430-L437
as the Collection::keys return a collection of keys, I expect methods taking keys as input also takes collection of keys.
Steps To Reproduce