'array', 'tags' => 'array', ]; protected $appends = [ 'tags', 'name_unit' ]; protected $fillable = [ 'order_id', 'goods_id', 'activity_type', 'number', 'status', 'price', 'original_price', 'vip_price', 'name', 'goods_unit', 'cover_img', 'spec', 'refund_time', 'created_at', 'updated_at', 'deleted_at', 'refuse_refund_note', 'refund_note', ]; public function goods() { return $this->belongsTo(Goods::class, 'goods_id', 'id'); } public function goodsActivity() { return $this->belongsTo(GoodsActivity::class, 'goods_id', 'id'); } public function getTagsAttribute() { return Goods::query()->where(['id' => $this->attributes['goods_id']])->value('tags'); } public function getNameUnitAttribute() { return $this->attributes['name'] . ' ' . $this->attributes['goods_unit']; } }