protected function validateUser(User $user, $teamId)
    {
        if ($user->hasMemberOnTeam($teamId)) {
            $validationException = ValidationException::withMessages(['email' => 'EMAIL_HAS_TEAM_EMPLOYEE']);
            throw $validationException;
        }
        if ($user->hasMemberInvitationOnTeam($teamId)) {
            $validationException = ValidationException::withMessages(['email' => 'EMAIL_HAS_TEAM_EMPLOYEE_INVITATION']);
            throw $validationException;
        }
        return $user;
    }
protected function validateUser(User $user, $teamId)
    {
        if ($user->hasMemberOnTeam($teamId)) {
            $validationException = ValidationException::withMessages(['email' => 'EMAIL_HAS_TEAM_EMPLOYEE']);
            throw $validationException;
        }
        if ($user->hasMemberInvitationOnTeam($teamId)) {
            $validationException = ValidationException::withMessages(['email' => 'EMAIL_HAS_TEAM_EMPLOYEE_INVITATION']);
            throw $validationException;
        }
        return $user;
    }
protected function validateUser ( User $ user , $ teamId ) { if ( $ user -> hasMemberOnTeam ( $ teamId ) ) { $ validationException = ValidationException :: withMessages ( [ 'email' => 'EMAIL_HAS_TEAM_EMPLOYEE' ] ) ; throw $ validationException ; } if ( $ user -> hasMemberInvitationOnTeam ( $ teamId ) ) { $ validationException = ValidationException :: withMessages ( [ 'email' => 'EMAIL_HAS_TEAM_EMPLOYEE_INVITATION' ] ) ; throw $ validationException ; } return $ user ; }
Validates MemberInvitations for existing Users to verify that invitation is not for a Team where User has
an existing Member and that an MemberInvitation does not already exist for the Team

@param User $user
@return User
@throws \Illuminate\Validation\ValidationException
Validates MemberInvitations for existing Users to verify that invitation is not for a Team where User has an existing Member and that an MemberInvitation does not already exist for the Team