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

[5.6] Add filledAny method to Request #23499

Merged
merged 3 commits into from
Mar 12, 2018
Merged

[5.6] Add filledAny method to Request #23499

merged 3 commits into from
Mar 12, 2018

Conversation

timacdonald
Copy link
Member

Currently to determine if the request has any filled values of a list of inputs, you do something like this:

if ($request->filled('disk') || $request->filled('site')) {
    //
}

This allows you to check if the request has filled values for any of the keys - similar to the existing hasAny.

if ($request->filledAny($filters)) {
    //
}

Although $request->filled($keys) accepts an array, it checks to determine if all the keys exist rather than any.

@JayBizzle
Copy link
Contributor

FYI, previously proposed here #21388

@ntzm
Copy link
Contributor

ntzm commented Mar 12, 2018

I think anyFilled is a better method name than filledAny, thoughts?

@taylorotwell taylorotwell merged commit 5403d02 into laravel:5.6 Mar 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants