Laravel 8 whereNull() {#collection-method}
whereNull
方法筛选给定键为 NULL 的项:
$collection = collect([
['name' => 'Desk'],
['name' => null],
['name' => 'Bookcase'],
]);
$filtered = $collection->whereNull('name');
$filtered->all();
/*
[
['name' => null],
]
*/