/** * @test */ public function canInviteUsersToGroup() { $this->setupAsHeadCoach(); $email = '*****@*****.**'; $this->visit('/group/' . $this->group()->id . '/settings/users')->see($this->headCoach()->full_name)->see('Owner')->click('Invite User')->type($email, 'email')->press('Send Invitation')->see('Invitation has been sent')->see('Pending Invitations')->see($email); $invitation = Invitation::where('email', $email)->first(); $this->assertEquals(Invitation::SENT, $invitation->status); }
public function claim($guid, $action) { $invitation = Invitation::where('guid', $guid)->firstOrFail(); if ($invitation->status != Invitation::SENT) { return $this->redirectRoute()->withFlashInfo('This invitation has expired or has already been claimed'); } if ($action == 'accept') { Session::setPendingInvitation($invitation); return $this->redirectRoute()->withFlashSuccess('Login to accept this invitation'); } else { $invitation->update(['status' => Invitation::DECLINED]); return $this->redirectRoute()->withFlashSuccess('Invitation has been declined'); } }
public function retractInvite(RetractUserInviteRequest $request, $groupId, $invitationId) { Invitation::where('id', $invitationId)->delete(); return redirect('/group/' . $request->route('group') . '/settings/users')->withFlashSuccess('Invitation has been retracted'); }