RSM-5 Made Vacancies easily linkable to Teams

This commit is contained in:
2020-10-09 22:27:36 +01:00
parent 6cc99d2ebe
commit 077ead9612
8 changed files with 200 additions and 34 deletions

View File

@@ -80,4 +80,32 @@ class Vacancy extends Model
}
/**
* Check if the Modal is attached to the $checkingTeam Model
*
* @param Team $checkingTeam The mdoel you want to check against
* @return boolean Whether the models are attached
*/
public function hasTeam(Team $checkingTeam): bool
{
$myTeams = $this->teams;
if (empty($myTeams))
{
// no associated teams
return false;
}
foreach($myTeams as $team)
{
if ($team->id === $checkingTeam->id)
{
return true;
}
}
return false;
}
}