forked from miguel456/rbrecruiter
Added Team Authorization Policy
This commit is contained in:
15
app/User.php
15
app/User.php
@@ -109,6 +109,21 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return ! is_null($this->twofa_secret);
|
||||
}
|
||||
|
||||
public function hasTeam($team): bool
|
||||
{
|
||||
if ($team instanceof Team || is_int($team))
|
||||
{
|
||||
return $this->teams->contains($team);
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* In PHP 8, we can just use union types and let PHP enforce this for us.
|
||||
*/
|
||||
throw new \InvalidArgumentException('Please pass either a Team object or an integer identifying a Team.');
|
||||
}
|
||||
}
|
||||
|
||||
public function routeNotificationForSlack($notification)
|
||||
{
|
||||
return config('slack.webhook.integrationURL');
|
||||
|
Reference in New Issue
Block a user