"专线", 1 => "直发车", 2 => "德邦物流", ]; static function nameById($id){ $logistic=Logistic::where('id',$id)->first(); return $logistic?$logistic['name']:''; } public function ownerPriceExpresses() { return $this->belongsToMany(OwnerPriceExpress::class,"owner_price_express_logistic","logistic_id","owner_price_express_id"); } public function getTagAttribute($value):string { if ($value==="" || $value===null)return ""; $tag = explode(",",$value); foreach ($tag as &$t)$t = self::TAGS[$t]; return implode(",",$tag); } public function users():BelongsToMany { //用户 return $this->belongsToMany(User::class,"logistic_user","logistic_id","user_id"); } }