GoodsSku.php 950 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Models;
  3. use DateTimeInterface;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * 商家商品规格表
  7. */
  8. class GoodsSku extends Model
  9. {
  10. /**
  11. * The table associated with the model.
  12. *
  13. * @var string
  14. */
  15. protected $table = 'goods_sku';
  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 $guarded = ['id', 'updated_at', 'created_at'];
  34. /**
  35. * 为数组 / JSON 序列化准备日期。
  36. *
  37. * @param DateTimeInterface $date
  38. * @return string
  39. */
  40. protected function serializeDate(DateTimeInterface $date)
  41. {
  42. return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
  43. }
  44. }