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

[8.x] Added whenHas() and whenFilled() to Request docs #6450

Merged
merged 1 commit into from Oct 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions requests.md
Expand Up @@ -233,6 +233,12 @@ When given an array, the `has` method will determine if all of the specified val
//
}

The `whenHas` method will execute the given callback if a value is present on the request:

$request->whenHas('name', function ($input) {
//
});

The `hasAny` method returns `true` if any of the specified values are present:

if ($request->hasAny(['name', 'email'])) {
Expand All @@ -245,6 +251,12 @@ If you would like to determine if a value is present on the request and is not e
//
}

The `whenFilled` method will execute the given callback if a value is present on the request and is not empty:

$request->whenFilled('name', function ($input) {
//
});

To determine if a given key is absent from the request, you may use the `missing` method:

if ($request->missing('name')) {
Expand Down