Goods.php 872 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\common\model;
  3. class Goods extends BaseModel
  4. {
  5. /**
  6. * @var string
  7. */
  8. protected $name = 'goods';
  9. /**
  10. * @var array
  11. */
  12. protected $auto = [];
  13. /**
  14. * @var array
  15. */
  16. protected $insert = ['created_at','updated_at'];
  17. /**
  18. * @var array
  19. */
  20. protected $update = ['updated_at'];
  21. /**
  22. * @var array
  23. */
  24. protected $hidden = ['updated_at'];
  25. /**
  26. * 关联分类
  27. * @return \think\model\relation\BelongsTo
  28. */
  29. public function category()
  30. {
  31. return $this->belongsTo('GoodsCategory','category_id','id');
  32. }
  33. /**
  34. * 关联获取Seller表
  35. * @return \think\model\relation\BelongsTo
  36. */
  37. public function seller()
  38. {
  39. return $this->belongsTo('Seller', 'seller_id', 'id');
  40. }
  41. }