ArticleCate.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Module\Article\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. /**
  7. * App\Module\Article\Models\ArticleCate
  8. *
  9. * field start
  10. * @property int $id
  11. * @property int $pid 父级分类
  12. * @property string $title 标题
  13. * @property string $unid 标识
  14. * @property string $img 首图
  15. * @property int $status
  16. * @property string $desc1 分类描述
  17. * @property \Carbon\Carbon $created_at
  18. * @property \Carbon\Carbon $updated_at
  19. * @property \Carbon\Carbon $deleted_at 删除时间
  20. * @property int $can_delete 是否可以删除的分类
  21. * field end
  22. */
  23. class ArticleCate extends Model
  24. {
  25. use HasDateTimeFormatter;
  26. use SoftDeletes;
  27. protected $table = 'article_cates';
  28. // attrlist start
  29. protected $fillable = [
  30. 'id',
  31. 'pid',
  32. 'title',
  33. 'unid',
  34. 'img',
  35. 'status',
  36. 'desc1',
  37. 'can_delete',
  38. ];
  39. // attrlist end
  40. /**
  41. * 获取分类列表
  42. *
  43. * @return array
  44. */
  45. public static function getCate(): array
  46. {
  47. return self::pluck('title', 'id')->toArray();
  48. }
  49. }