You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.0 KiB
55 lines
1.0 KiB
<?php
|
|
|
|
namespace App\Model\v3;
|
|
|
|
use App\Model\Model;
|
|
|
|
class OrderGoods extends Model
|
|
{
|
|
protected $table = 'lanzu_order_goods';
|
|
|
|
protected $casts = [
|
|
'spec' => 'array',
|
|
'tags' => 'array',
|
|
];
|
|
|
|
protected $appends = [
|
|
'tags'
|
|
];
|
|
|
|
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');
|
|
}
|
|
}
|