hasMany(ShippingTemplateFree::class, 'temp_id', 'shipping_template_id'); } /** * 配送 * @Author:Qinii * @Date: 2020/5/6 * @Time: 18:01 * @return \think\model\relation\HasMany */ public function region() { return $this->hasMany(ShippingTemplateRegion::class, 'temp_id', 'shipping_template_id'); } /** * @return \think\model\relation\HasOne * @author zfy * @day 2020/6/4 */ public function freeAddress() { return $this->hasOne(ShippingTemplateFree::class, 'temp_id', 'shipping_template_id'); } /** * @return \think\model\relation\HasOne * @author zfy * @day 2020/6/4 */ public function regionAddress() { return $this->hasOne(ShippingTemplateRegion::class, 'temp_id', 'shipping_template_id'); } /** * @Author:Qinii * @Date: 2020/5/6 * @Time: 18:01 * @return \think\model\relation\HasOne */ public function undelives() { return $this->hasOne(ShippingTemplateUndelivery::class, 'temp_id', 'shipping_template_id'); } public function searchShippingTemplateIdAttr($query,$value) { $query->where('shipping_template_id',$value); } }