Article.php 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-04-20
  7. *
  8. *
  9. */
  10. namespace app\common\model\article;
  11. use app\common\model\BaseModel;
  12. class Article extends BaseModel
  13. {
  14. /**
  15. * @return string
  16. * @author xaboy
  17. * @day 2020-03-30
  18. */
  19. public static function tablePk(): string
  20. {
  21. return 'article_id';
  22. }
  23. /**
  24. * @return string
  25. * @author xaboy
  26. * @day 2020-03-30
  27. */
  28. public static function tableName(): string
  29. {
  30. return 'article';
  31. }
  32. /**
  33. * @return \think\model\relation\HasOne
  34. * @author Qinii
  35. */
  36. public function content()
  37. {
  38. return $this->hasOne(ArticleContent::class,'article_content_id','article_id');
  39. }
  40. /**
  41. * @return \think\model\relation\HasOne
  42. * @author Qinii
  43. */
  44. public function articleCategory()
  45. {
  46. return $this->hasOne(ArticleCategory::class ,'article_category_id','cid')
  47. ->field('article_category_id,title,pid');
  48. }
  49. }