【has关联查询】能不能查询未关联到的条数

浏览:331 发布日期:2018/09/06 分类:求助交流
    /** 关联订单语音 */
     public function toVoice(){
        return $this->hasMany('VoiceList','order_id','order_id');
    }
    if($order_state == 'review'){
        return $this->has('toVoiceForecaster','>','0')
        ->where(['forecaster_id' => $team_id,'order_state' => '10'])
        ->paginate(10);
    }
    if($order_state == 'reply'){
        return $this->has('toVoiceForecaster','=','0')
        ->where(['forecaster_id' => $self_id,'order_state' => '10'])
        ->paginate(10);
    }
如上代码,has('toVoiceForecaster','=','1') 是有效的,has('toVoiceForecaster','=','0')返回的就是空数组,我需要的是查询关联表未关联到的数据
最佳答案
评论() 相关
后面还有条评论,点击查看>>