老师 scope 是不需要加 Builder 的吧
来源:14-3 使用全局scope进行软删除模型

hallo_monde
2017-09-04
public function scopeTopicNotBy(Builder $query, $topic_id)
{
return $query->doesntHave('postTopics', 'and', function($q) use ($topic_id) {
$q->where("topic_id", $topic_id);
});
}
public function scopeAuthorBy($query, $user_id)
{
return $query->where('user_id', $user_id);
}
这里不加 Builder 也是好用的额
写回答
2回答
-
zhengyiunity
2017-10-24
PHPStorm 给我默认加了个 :
use PhpParser\Builder;
导致我报错。
00 -
轩脉刃
2017-09-06
嗯,默认第一个参数是Builder类型
032018-07-12
相似问题