Order.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Models\Order;
  3. use App\Base\BaseModel;
  4. use App\Models\User\User;
  5. /**
  6. * App\Models\Order\Order
  7. *
  8. * @property int $id
  9. * @property int $user_id
  10. * @property \Illuminate\Support\Carbon|null $created_at
  11. * @property \Illuminate\Support\Carbon|null $updated_at
  12. * @method static \Illuminate\Database\Eloquent\Builder|Order newModelQuery()
  13. * @method static \Illuminate\Database\Eloquent\Builder|Order newQuery()
  14. * @method static \Illuminate\Database\Eloquent\Builder|Order query()
  15. * @method static \Illuminate\Database\Eloquent\Builder|Order whereCreatedAt($value)
  16. * @method static \Illuminate\Database\Eloquent\Builder|Order whereId($value)
  17. * @method static \Illuminate\Database\Eloquent\Builder|Order whereUpdatedAt($value)
  18. * @method static \Illuminate\Database\Eloquent\Builder|Order whereUserId($value)
  19. * @mixin \Eloquent
  20. * @property string $source 来源
  21. * @method static \Illuminate\Database\Eloquent\Builder|Order whereSource($value)
  22. * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Order\OrderGoods[] $goods
  23. * @property-read int|null $goods_count
  24. * @property-read User|null $user
  25. */
  26. class Order extends BaseModel
  27. {
  28. const SOURCE_GOODS = "goods";
  29. const SOURCE_CART = "cart";
  30. protected $table = "order";
  31. public function goods()
  32. {
  33. return $this->hasMany(OrderGoods::class);
  34. }
  35. public function user()
  36. {
  37. return $this->belongsTo(User::class);
  38. }
  39. }