Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Document whereNull and whereNotNull collection methods #5792

Merged
merged 4 commits into from
Feb 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ For the remainder of this documentation, we'll discuss each method available on
[whereNotBetween](#method-wherenotbetween)
[whereNotIn](#method-wherenotin)
[whereNotInStrict](#method-wherenotinstrict)
[whereNotNull](#method-wherenotnull)
[whereNull](#method-wherenull)
[wrap](#method-wrap)
[zip](#method-zip)

Expand Down Expand Up @@ -2453,6 +2455,50 @@ The `whereNotIn` method uses "loose" comparisons when checking item values, mean

This method has the same signature as the [`whereNotIn`](#method-wherenotin) method; however, all values are compared using "strict" comparisons.

<a name="method-wherenotnull"></a>
#### `whereNotNull()` {#collection-method}

The `whereNotNull` method filters items 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'],
]
*/

<a name="method-wherenull"></a>
#### `whereNull()` {#collection-method}

The `whereNull` method filters items where the given key is null:

$collection = collect([
['name' => 'Desk'],
['name' => null],
['name' => 'Bookcase'],
]);

$filtered = $collection->whereNull('name');

$filtered->all();

/*
[
['name' => null],
]
*/


<a name="method-wrap"></a>
#### `wrap()` {#collection-method}

Expand Down