示例#1
0
 /**
  * @param KTeam $team
  * @return bool
  */
 public function canHandleTeam(KTeam $team)
 {
     $user = \Auth::user();
     if ($team->tournament->isRegistrationOpen() == 6 || $team->tournament->isRegistrationOpen() == 5) {
         return false;
     }
     /**
      * If Manager
      */
     if ($user->canManageTournament($team->tournament)) {
         return true;
     }
     // Donot allow if team is not approved
     if (!$team->isApproved()) {
         return false;
     }
     if ($team->playerspivot()->where('user_id', $user->id)->where('user_status', '>', 3)->first()) {
         return true;
     }
     return false;
 }