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

Conversation

Projects
None yet
4 participants
@timacdonald
Contributor

timacdonald commented Mar 12, 2018

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

This comment has been minimized.

Contributor

JayBizzle commented Mar 12, 2018

FYI, previously proposed here #21388

@ntzm

This comment has been minimized.

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

2 checks passed

continuous-integration/styleci/pr The StyleCI analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment