X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FPolicies%2FTournamentPolicy.php;fp=app%2FPolicies%2FTournamentPolicy.php;h=a95dc95001a5c5fe1453cf8680fe9ecb4d8cbfb8;hb=3a774bb649734fc3a2135ec1b52cef9a049880ee;hp=5942b7f7979c8ff215275b9e6a83d6853e8624b7;hpb=8d97d023740e438361e659c6e133418e33343178;p=alttp.git diff --git a/app/Policies/TournamentPolicy.php b/app/Policies/TournamentPolicy.php index 5942b7f..a95dc95 100644 --- a/app/Policies/TournamentPolicy.php +++ b/app/Policies/TournamentPolicy.php @@ -104,6 +104,18 @@ class TournamentPolicy return !$tournament->locked && ($user->isRunner($tournament) || $user->isTournamentAdmin($tournament)); } + /** + * Determine whether the user can apply to participate. + * + * @param \App\Models\User $user + * @param \App\Models\Tournament $tournament + * @return \Illuminate\Auth\Access\Response|bool + */ + public function apply(User $user, Tournament $tournament) + { + return $tournament->accept_applications && !$user->isRunner($tournament) && !$user->isApplicant($tournament); + } + /** * Determine whether the user can view the tournament protocol. *