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

[11.x] Add documentation for Context::missing() #10154

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
6 changes: 5 additions & 1 deletion context.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,18 @@ $data = Context::all();
<a name="determining-item-existence"></a>
### Determining Item Existence

You may use the `has` method to determine if the context has any value stored for the given key:
You may use the `has` and `missing` methods to determine if the context has any value stored for the given key:

```php
use Illuminate\Support\Facades\Context;

if (Context::has('key')) {
// ...
}

if (Context::missing('key')) {
// ...
}
```

The `has` method will return `true` regardless of the value stored. So, for example, a key with a `null` value will be considered present:
Expand Down