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.
 
 

34 lines
643 B

<?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'
];
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');
}
}