OrderItem.php 814 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Models;
  3. use DateTimeInterface;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * 外卖订单商品子表
  7. */
  8. class OrderItem extends Model
  9. {
  10. /**
  11. * The table associated with the model.
  12. *
  13. * @var string
  14. */
  15. protected $table = 'order_item';
  16. /**
  17. * The primary key associated with the table.
  18. *
  19. * @var string
  20. */
  21. protected $primaryKey = 'id';
  22. /**
  23. * Indicates if the model should be timestamped.
  24. *
  25. * @var bool
  26. */
  27. public $timestamps = true;
  28. /**
  29. * 类型转换
  30. *
  31. * @var array
  32. */
  33. protected $casts = [
  34. 'goods_spec_list' => 'array',
  35. ];
  36. /**
  37. * 不能被批量赋值的属性
  38. *
  39. * @var array
  40. */
  41. protected $guarded = ['id', 'updated_at', 'created_at'];
  42. }