GoodsSku.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace App\Models;
  3. use DateTimeInterface;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * 商家商品规格表
  7. *
  8. * @property int $id 商品规格表
  9. * @property int $goods_id 商品id
  10. * @property string|null $sku_name 规格名称
  11. * @property int $sku_type 1:单选, 2:多选
  12. * @property int $affect_quantity 是否影响购物车数量: 0-不影响, 1-影响
  13. * @property int $is_del 是否删除
  14. * @property \Illuminate\Support\Carbon|null $created_at
  15. * @property \Illuminate\Support\Carbon|null $updated_at
  16. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku newModelQuery()
  17. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku newQuery()
  18. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku query()
  19. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereAffectQuantity($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereCreatedAt($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereGoodsId($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereId($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereIsDel($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereSkuName($value)
  25. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereSkuType($value)
  26. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSku whereUpdatedAt($value)
  27. * @mixin \Eloquent
  28. */
  29. class GoodsSku extends Model
  30. {
  31. /**
  32. * The table associated with the model.
  33. *
  34. * @var string
  35. */
  36. protected $table = 'goods_sku';
  37. /**
  38. * The primary key associated with the table.
  39. *
  40. * @var string
  41. */
  42. protected $primaryKey = 'id';
  43. /**
  44. * Indicates if the model should be timestamped.
  45. *
  46. * @var bool
  47. */
  48. public $timestamps = true;
  49. /**
  50. * 不能被批量赋值的属性
  51. *
  52. * @var array
  53. */
  54. protected $guarded = ['id', 'updated_at', 'created_at'];
  55. /**
  56. * 为数组 / JSON 序列化准备日期。
  57. *
  58. * @param DateTimeInterface $date
  59. * @return string
  60. */
  61. protected function serializeDate(DateTimeInterface $date)
  62. {
  63. return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
  64. }
  65. }