Skip to content

Commit 86a8967

Browse files
committed
Admin - Invite Administrator - resend invite
1 parent 733f450 commit 86a8967

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

app/Http/Controllers/Admin/Settings/AdministratorsController.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,19 @@ public function showInvites()
4747
public function postInvite(Request $request)
4848
{
4949
$this->validate($request, [
50-
'email' => 'required|email|unique:users|unique:user_invites'
50+
'email' => 'required|email|unique:users' // |unique:user_invites
5151
]);
5252

53-
// create row
54-
$row = UserInvite::create([
55-
'email' => input('email'),
56-
'token' => '-',
57-
'invited_by' => user()->id,
58-
]);
53+
// if already exist - send invite again
54+
$row = UserInvite::where('email', input('email'))->first();
55+
if (!$row) {
56+
// create row
57+
$row = UserInvite::create([
58+
'email' => input('email'),
59+
'token' => '-',
60+
'invited_by' => user()->id,
61+
]);
62+
}
5963

6064
// send mail to email
6165
Mail::send(new AdminInvitRegistration($row));

0 commit comments

Comments
 (0)