Article.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\article;
  12. use app\common\model\BaseModel;
  13. class Article extends BaseModel
  14. {
  15. /**
  16. * @return string
  17. * @author xaboy
  18. * @day 2020-03-30
  19. */
  20. public static function tablePk(): string
  21. {
  22. return 'article_id';
  23. }
  24. /**
  25. * @return string
  26. * @author xaboy
  27. * @day 2020-03-30
  28. */
  29. public static function tableName(): string
  30. {
  31. return 'article';
  32. }
  33. /**
  34. * @return \think\model\relation\HasOne
  35. * @author Qinii
  36. */
  37. public function content()
  38. {
  39. return $this->hasOne(ArticleContent::class,'article_content_id','article_id');
  40. }
  41. /**
  42. * @return \think\model\relation\HasOne
  43. * @author Qinii
  44. */
  45. public function articleCategory()
  46. {
  47. return $this->hasOne(ArticleCategory::class ,'article_category_id','cid')
  48. ->field('article_category_id,title');
  49. }
  50. }