company_id dropped on user invitations

This commit is contained in:
Sevan Nerse
2022-06-28 21:44:19 +03:00
parent 90a2330ae2
commit d7c101e025
5 changed files with 107 additions and 13 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;
}