GoodsComponent.php 776 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\model;
  3. use support\Model;
  4. class GoodsComponent extends Model
  5. {
  6. protected $table = 'goods_component';
  7. protected $primaryKey = 'goods_component_id';
  8. protected $dateFormat = 'U';
  9. const CREATED_AT = 'goods_component_addtimes';
  10. const UPDATED_AT = null;
  11. public function package()
  12. {
  13. return $this->hasOne(Goods::class, 'goods_id', 'join_component_master_goods_id')
  14. ->select('goods_name', 'goods_market_price', 'goods_sales_price', 'goods_cover');
  15. }
  16. public function goods()
  17. {
  18. return $this->hasOne(Goods::class, 'goods_id', 'join_component_goods_id')
  19. ->select('goods_id', 'goods_name', 'goods_market_price', 'goods_sales_price', 'goods_cover','join_goods_supplier_id');
  20. }
  21. }