裸熊家族

导航

laravel Builder scope count() 出错 Eloquent/Builder.php 1185行

 在创建项目的使用登录之后报错

ErrorException in Builder.php line 1185:
count(): Parameter must be an array or an object that implements Countable
in Builder.php line 1185
vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php,然后在到1185后见到这样的代码
 
1
$originalWhereCount = count($query->wheres);
 
 
这里就报错了,原因可能这里空值或其他,我们修改如下
 
1
$originalWhereCount = empty($query->wheres) ? 0 : count($query->wheres);
 
 
                     over

posted on 2019-06-09 14:21  裸熊家族  阅读(427)  评论(1编辑  收藏  举报