BlueCategory.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\model\blue;
  3. use app\extra\basic\Model;
  4. use think\model\relation\HasMany;
  5. use think\model\relation\HasOne;
  6. /**
  7. * @property integer $id (主键)
  8. * @property string $name 名称
  9. * @property string $icon 普通图标
  10. * @property string $small_icon 小图标
  11. * @property integer $sort 排序
  12. * @property integer $type 1任务2文章
  13. * @property mixed $create_at 创建时间
  14. */
  15. class BlueCategory extends Model
  16. {
  17. /**
  18. * The connection name for the model.
  19. *
  20. * @var string|null
  21. */
  22. protected $connection = 'mysql';
  23. /**
  24. * The table associated with the model.
  25. *
  26. * @var string
  27. */
  28. protected string $table = "blue_category";
  29. /**
  30. * The primary key associated with the table.
  31. *
  32. * @var string
  33. */
  34. protected string $primaryKey = "id";
  35. /**
  36. * Indicates if the model should be timestamped.
  37. *
  38. * @var bool
  39. */
  40. public bool $timestamps = false;
  41. public function article(): HasMany
  42. {
  43. return $this->hasMany(BlueArticle::class,"category","id");
  44. }
  45. public function platform(): HasOne
  46. {
  47. return $this->hasOne(BlueExpertPlatform::class,"source","sign");
  48. }
  49. }