Admin.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Tplay [ WE ONLY DO WHAT IS NECESSARY ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017 http://tplay.pengyichen.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 听雨 < 389625819@qq.com >
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\model;
  12. use think\Model;
  13. class Admin extends Model
  14. {
  15. const SUPER_ADMIN_ID = 1;//默认超级管理员id
  16. public function admincate()
  17. {
  18. //关联角色表
  19. return $this->belongsTo('AdminCate');
  20. }
  21. public function article()
  22. {
  23. //关联文章表
  24. return $this->hasOne('Article');
  25. }
  26. public function log()
  27. {
  28. //关联日志表
  29. return $this->hasOne('AdminLog');
  30. }
  31. public function attachment()
  32. {
  33. //关联附件表
  34. return $this->hasOne('Attachment');
  35. }
  36. }