Laravel 8 whereNotNull() {#collection-method
2021-07-19 10:01 更新
whereNotNull
方法筛选给定键不为 NULL 的项:
$collection = collect([
['name' => 'Desk'],
['name' => null],
['name' => 'Bookcase'],
]);
$filtered = $collection->whereNotNull('name');
$filtered->all();
/*
[
['name' => 'Desk'],
['name' => 'Bookcase'],
]
*/
以上内容是否对您有帮助:
更多建议: