-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[7.x] Add isNotFilled() method to Request #33732
Conversation
In other parts of the framework, "blank" is used as the opposite of filled: https://laravel.com/docs/7.x/helpers#method-blank PHP's empty('0');
// true
request()->replace(['foo' => '0'])->empty('foo');
// false Since (Ruby on Rails also uses blank: https://api.rubyonrails.org/classes/Object.html#method-i-blank-3F) |
I don't think we should try to emulate PHP's empty function. That behaviour is usually not what people intended. |
We already don't emulate About the name, I'm open to change it, if requested. My suggestions are: |
@GrahamCampbell I think @derekmd was suggesting w use the name |
If we rename to |
The same way, request()->replace(['foo' => []])->filled('foo'); // true My goal here is to find a way to negate the |
So far I'm just not happy with the naming options. We could use |
|
Very often, I use
! $request->filled()
, and it's ok, I can live with it. But I would love to have anempty()
method. So, instead of:Would be possible to use:
The
empty()
method here is just the opposite offilled()
(in the sense of behavior) to maintain the cognitive consistency when using one or another.About the name, if
empty()
isn't that good, we can choose another one, but I prefer the first one.Ps: I know I can use a macro if this gets rejected. 😁