laravel 远程一对多实例

 /**
     * 关联楼宇推荐书关联表
     * 远程一对一
     */
    public function buildingPanos()
    {
        return $this->hasManyThrough(
            'App\Building',                // 远程表
            'App\ModelList\BuildingPano',  // 中间表
            'pano_id',                     // 中间表对主表的关联字段
            'id',                          // 远程表对中间表的关联字段
            'pano_config_id',              // 主表对中间表的关联字段
            'building_id'                  // 中间表对远程表的关联字段
        );
    }

  

原文地址:https://www.cnblogs.com/lxwphp/p/15453403.html