hasOne(CustomerProduct::class, 'id', 'cus_pro_id')->field('id,customer_id,status,pay_date'); } public function getImgAttr($value) { if ($value) { return cdnurl(File::getUrl($value), true); } else { return $value; } } public function product() { return $this->hasOne(Product::class, 'id', 'pro_id')->field('id,name,num,img,unit,price,description'); } }