Skip to content

Commit

Permalink
fix(helper): exclude Model instances from blank check (#804)
Browse files Browse the repository at this point in the history
* fix(helper): exclude Model instances from blank check

* fix(tests): add Model instance to blank check test cases

---------

Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia authored Dec 18, 2024
1 parent c059c02 commit d7dd15e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use Hyperf\Context\ApplicationContext;
use Hyperf\Contract\SessionInterface;
use Hyperf\Contract\ValidatorInterface;
use Hyperf\Database\Model\Model;
use Hyperf\HttpMessage\Cookie\Cookie;
use Hyperf\HttpMessage\Cookie\CookieJarInterface;
use Hyperf\HttpMessage\Stream\SwooleStream;
Expand Down Expand Up @@ -98,6 +99,10 @@ function blank($value): bool
return false;
}

if ($value instanceof Model) {
return false;
}

if ($value instanceof Countable) {
return count($value) === 0;
}
Expand Down

0 comments on commit d7dd15e

Please sign in to comment.