/** * Invite the user to a slack team * * @param User $user * @throws SlackMailException * @throws SlackTeamInvitationException */ private function processMemberInvitation(User $user) { try { $this->getSlackApi()->inviteToTeam($user->email); // update Slack user relation SlackUser::create(['user_id' => $user->id, 'invited' => true]); } catch (SlackMailException $e) { $this->logEvent('mail'); } catch (SlackTeamInvitationException $e) { $this->logEvent('sync'); } }