Merge pull request #2498 from sevannerse/user-works

User works
This commit is contained in:
Cüneyt Şentürk
2022-07-03 10:21:18 +03:00
committed by GitHub
17 changed files with 252 additions and 144 deletions

View File

@@ -110,31 +110,25 @@ trait Users
}
/**
* Checks if the given user has a pending invitation for the
* provided Company.
* Checks if the given user has a pending invitation.
*
* @return bool
*/
public function hasPendingInvitation($company_id = null)
public function hasPendingInvitation()
{
$company_id = $company_id ?: company_id();
$invitation = UserInvitation::where('user_id', $this->id)->where('company_id', $company_id)->first();
$invitation = UserInvitation::where('user_id', $this->id)->first();
return $invitation ? true : false;
}
/**
* Returns if the given user has a pending invitation for the
* provided Company.
* Returns if the given user has a pending invitation.
*
* @return null|UserInvitation
*/
public function getPendingInvitation($company_id = null)
public function getPendingInvitation()
{
$company_id = $company_id ?: company_id();
$invitation = UserInvitation::where('user_id', $this->id)->where('company_id', $company_id)->first();
$invitation = UserInvitation::where('user_id', $this->id)->first();
return $invitation;
}