Order.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Order extends Model
  5. {
  6. public function orderDetails()
  7. {
  8. return $this->hasMany(OrderDetail::class);
  9. }
  10. public function details()
  11. {
  12. return $this->hasMany(OrderDetail::class, 'order_id');
  13. }
  14. public function refund_requests()
  15. {
  16. return $this->hasMany(RefundRequest::class);
  17. }
  18. public function user()
  19. {
  20. return $this->belongsTo(User::class);
  21. }
  22. public function shop()
  23. {
  24. return $this->hasOne(Shop::class, 'user_id', 'seller_id');
  25. }
  26. public function pickup_point()
  27. {
  28. return $this->belongsTo(PickupPoint::class);
  29. }
  30. public function affiliate_log()
  31. {
  32. return $this->hasMany(AffiliateLog::class);
  33. }
  34. public function club_point()
  35. {
  36. return $this->hasMany(ClubPoint::class);
  37. }
  38. public function delivery_boy()
  39. {
  40. return $this->belongsTo(User::class, 'assign_delivery_boy', 'id');
  41. }
  42. public function proxy_cart_reference_id()
  43. {
  44. return $this->hasMany(ProxyPayment::class)->select('reference_id');
  45. }
  46. }