OrderGoods.php 707 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class OrderGoods extends Model
  5. {
  6. //定义表
  7. protected $table = "order_goods";
  8. //定义主键
  9. protected $primaryKey = "id";
  10. protected $fillable = ['order_id','goods_id','sku_id','reward_id','breakup_id','price','manual_id','num','totalprice'];
  11. public function order()
  12. {
  13. return $this->belongsTo('App\Models\Order','order_id','id')->withTrashed();
  14. }
  15. public function goods()
  16. {
  17. return $this->hasOne('App\Models\Goods','id','goods_id')->withTrashed();
  18. }
  19. public function orderbreakup()
  20. {
  21. return $this->belongsTo('App\Models\OrderBreakup','breakup_id','id');
  22. }
  23. }