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 也是好用的额
Laravel最新特性结合Mysql异步消息队列、ElasticSearch搜索引擎、Debugbar调试利器开发简书
了解课程