Goods.php 759 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace addons\qingdongams\model;
  3. use think\Model;
  4. use traits\model\SoftDelete;
  5. class Goods extends Model
  6. {
  7. use SoftDelete;
  8. // 表名
  9. protected $name = 'qingdongams_goods';
  10. // 自动写入时间戳字段
  11. protected $autoWriteTimestamp = 'int';
  12. // 定义时间戳字段名
  13. protected $createTime = 'createtime';
  14. protected $updateTime = 'updatetime';
  15. protected $deleteTime = 'deletetime';
  16. // 追加属性
  17. protected $append = [
  18. ];
  19. public function type(){
  20. return $this->hasOne(Producttype::class,'id','type_id');
  21. }
  22. public function product(){
  23. return $this->hasOne(Product::class,'goods_id','id');
  24. }
  25. }