NoxxieNl
To show how the filter function works with a collection.
$collect = collect([
[
'name' => 'all',
],
[
'name' => 'confiscation_vainly'
]
]);
$filterd = $collect->filter(function($cost) {
return $cost['name'] == 'all' || $cost['name'] == 'confiscation_vainly';
})->where('name', 'all');
$filterd->first();
=> [
"name" => "all",
]