public function tags()
{
    return $this->hasManyThrough(
        Tags::class,// 远程表
        TopicTags::class,// 中间表
        'topic_id', // 中间表对主表的关联字段
        'id', // 远程表对中间表的关联字段
        'id',  // 主表对中间表的关联字段
        'tag_id' // 中间表对远程表的关联字段
    );
}
最后修改:2021 年 07 月 16 日 11 : 38 AM
如果觉得我的文章对你有用,请随意赞赏