hasOne(User::class, 'id', 'user_id'); } // 关联订单 public function order(): HasOne { return $this->hasOne(Order::class, 'oid', 'order_id'); } public function getBeforeAttribute($value) { return $this->attributes['before'] = flowAutoShow($value); } public function getAfterAttribute($value) { return $this->attributes['after'] = flowAutoShow($value); } }