belongsTo('production', 'product_unit','id'); } function unitsTest() { return $this->belongsTo('unitsTest', 'units_id', 'id'); } public function selectSampleListByTaskIdAndUid($where,$pageNum=1,$pageSize=null) { $cyd = (new Cyd()); $data = $cyd->with(['Production', 'UnitsTest'])->where($where)->page($pageNum,$pageSize)->select(); return $data; } public function countSampleListByTaskIdAndUid($where) { $cyd = (new Cyd()); $count = $cyd->with(['Production', 'UnitsTest'])->where($where)->count(); return $count; } }