Approve.php 660 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\common\model;
  3. use app\common\constant\CommonConstant;
  4. use think\Model;
  5. /**
  6. * 审批模型
  7. */
  8. class Approve extends Model
  9. {
  10. // 表名
  11. protected $name = 'approve';
  12. // 关联用户
  13. public function user()
  14. {
  15. return $this->belongsTo(User::class, 'approve_user', 'userid')->where('is_deleted',CommonConstant::IS_DELETED_0);
  16. }
  17. // 关联审批申请 join
  18. public function approveInfo()
  19. {
  20. return $this->belongsTo(ApproveInfo::class, 'info_id', 'id');
  21. }
  22. public function approveInfoUser()
  23. {
  24. return $this->belongsTo(User::class, 'approve_info.user_id', 'userid');
  25. }
  26. }