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.

33 lines
643 B

  1. <?php
  2. namespace App\Model\v3;
  3. use App\Model\Model;
  4. class OrderGoods extends Model
  5. {
  6. protected $table = 'lanzu_order_goods';
  7. protected $casts = [
  8. 'spec' => 'array',
  9. 'tags' => 'array',
  10. ];
  11. protected $appends = [
  12. 'tags'
  13. ];
  14. public function goods()
  15. {
  16. return $this->belongsTo(Goods::class, 'goods_id', 'id');
  17. }
  18. public function goodsActivity()
  19. {
  20. return $this->belongsTo(GoodsActivity::class, 'goods_id', 'id');
  21. }
  22. public function getTagsAttribute()
  23. {
  24. return Goods::query()->where(['id' => $this->attributes['goods_id']])->value('tags');
  25. }
  26. }