阅读(3919)
赞(8)
Laravel 8 whereNotNull() {#collection-method
2021-07-01 16:46:26 更新
whereNotNull
方法筛选给定键不为 NULL 的项:
$collection = collect([
['name' => 'Desk'],
['name' => null],
['name' => 'Bookcase'],
]);
$filtered = $collection->whereNotNull('name');
$filtered->all();
/*
[
['name' => 'Desk'],
['name' => 'Bookcase'],
]
*/