OrderGoods.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Models\Order;
  3. use App\Base\BaseModel;
  4. use App\Models\Goods\Goods;
  5. /**
  6. * App\Models\Order\OrderGoods
  7. *
  8. * @property int $id
  9. * @property int $order_id
  10. * @property int $goods_id
  11. * @property string $sn
  12. * @property int $count
  13. * @property \Illuminate\Support\Carbon|null $created_at
  14. * @property \Illuminate\Support\Carbon|null $updated_at
  15. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods newModelQuery()
  16. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods newQuery()
  17. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods query()
  18. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereCount($value)
  19. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereCreatedAt($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereGoodsId($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereId($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereOrderId($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereSn($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereUpdatedAt($value)
  25. * @mixin \Eloquent
  26. * @property int $sku_id
  27. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereSkuId($value)
  28. * @property-read \App\Models\Order\Order|null $order
  29. * @property-read Goods|null $goods
  30. * @property array $custom
  31. * @method static \Illuminate\Database\Eloquent\Builder|OrderGoods whereCustom($value)
  32. */
  33. class OrderGoods extends BaseModel
  34. {
  35. protected $table = "order_goods";
  36. protected $casts = [
  37. "custom" => "array",
  38. ];
  39. public function order()
  40. {
  41. return $this->belongsTo(Order::class);
  42. }
  43. public function goods()
  44. {
  45. return $this->belongsTo(Goods::class, "goods_id");
  46. }
  47. }