GoodsCategory.php 2.1 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 $shop_id 商家id
  10. * @property string $name 分类名称
  11. * @property int $sort 排序方式(数字越小越靠前)
  12. * @property int $is_del 是否删除
  13. * @property \Illuminate\Support\Carbon|null $created_at
  14. * @property \Illuminate\Support\Carbon|null $updated_at
  15. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory newModelQuery()
  16. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory newQuery()
  17. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory query()
  18. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereCreatedAt($value)
  19. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereId($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereIsDel($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereName($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereShopId($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereSort($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|GoodsCategory whereUpdatedAt($value)
  25. * @mixin \Eloquent
  26. */
  27. class GoodsCategory extends Model
  28. {
  29. /**
  30. * The table associated with the model.
  31. *
  32. * @var string
  33. */
  34. protected $table = 'goods_category';
  35. /**
  36. * The primary key associated with the table.
  37. *
  38. * @var string
  39. */
  40. protected $primaryKey = 'id';
  41. /**
  42. * Indicates if the model should be timestamped.
  43. *
  44. * @var bool
  45. */
  46. public $timestamps = true;
  47. /**
  48. * 不能被批量赋值的属性
  49. *
  50. * @var array
  51. */
  52. protected $guarded = ['id', 'updated_at', 'created_at'];
  53. /**
  54. * 为数组 / JSON 序列化准备日期。
  55. *
  56. * @param DateTimeInterface $date
  57. * @return string
  58. */
  59. protected function serializeDate(DateTimeInterface $date)
  60. {
  61. return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
  62. }
  63. }