File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
app/Http/Controllers/Admin/Settings Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff 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 ));
You can’t perform that action at this time.
0 commit comments