GoodsSpec.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 $sku_id 商品sku标识
  11. * @property string|null $spec_name 规格名称
  12. * @property string $spec_price 商品价格
  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|GoodsSpec newModelQuery()
  17. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec newQuery()
  18. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec query()
  19. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereCreatedAt($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereGoodsId($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereId($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereIsDel($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereSkuId($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereSpecName($value)
  25. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereSpecPrice($value)
  26. * @method static \Illuminate\Database\Eloquent\Builder|GoodsSpec whereUpdatedAt($value)
  27. * @mixin \Eloquent
  28. */
  29. class GoodsSpec extends Model
  30. {
  31. /**
  32. * The table associated with the model.
  33. *
  34. * @var string
  35. */
  36. protected $table = 'goods_spec';
  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. }