no message

This commit is contained in:
kuaifan
2021-06-15 11:01:23 +08:00
parent 7b91a53a71
commit 3355aa0bbf
7 changed files with 90 additions and 11 deletions

View File

@@ -232,6 +232,20 @@ class Project extends AbstractModel
return $this->projectUser->pluck('userid')->toArray();
}
/**
* 会员id是否在项目里
* @param int $userid
* @return int 0:不存在、1存在、2存在且是管理员
*/
public function useridInTheProject($userid)
{
$user = ProjectUser::whereProjectId($this->id)->whereUserid(intval($userid))->first();
if (empty($user)) {
return 0;
}
return $user->owner ? 2 : 1;
}
/**
* 删除项目
* @return bool