Laravel - Collections - Method Wherenotnull

The whereNotNull method returns items from the collection where the given key is not null:

    
    $collection = collect([
        ['name' => 'Desk'],
        ['name' => null],
        ['name' => 'Bookcase'],
    ]);
    
    $filtered = $collection->whereNotNull('name');
    
    $filtered->all();
    
    /*
        [
            ['name' => 'Desk'],
            ['name' => 'Bookcase'],
        ]
    */