[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');
// falseSince (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'); // trueMy 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. 😁