Skip to content

Commit d8b8142

Browse files
committed
Added user confirmation mail to admin email
1 parent 668f246 commit d8b8142

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

app/Http/Controllers/Auth/RegisteredUserController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Illuminate\Support\Facades\Auth;
1111
use Illuminate\Support\Facades\Hash;
1212
use Illuminate\Support\Facades\DB;
13+
use Illuminate\Support\Facades\Mail;
1314

1415
class RegisteredUserController extends Controller
1516
{
@@ -68,6 +69,18 @@ public function store(Request $request)
6869
$user->block = $block;
6970
$user->save();
7071

72+
73+
$user = $request->name;
74+
$email = $request->email;
75+
76+
try {
77+
Mail::send('auth.user-confirmation', ['user' => $user, 'email' => $email], function ($message) use ($user) {
78+
$message->to(env('ADMIN_EMAIL'))
79+
->subject('New user registration');
80+
});
81+
} catch (\Exception $e) {}
82+
83+
7184
event(new Registered($user));
7285

7386
return redirect(url('dashboard'));
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<x-guest-layout>
2+
<div class="mb-4 text-sm text-gray-600">
3+
<h2>A new user has registered on {{ str_replace(['http://', 'https://'], '', url('')) }} and is awaiting verification</h2>
4+
<p>The user <i>{{$user}}</i> with the email <i>{{$email}}</i> has registered a new account on {{ url('') }} and is awaiting confirmation by an admin. Click <a href="{{ url('admin/users/all') }}">here</a> to verify the user.</p>
5+
</div>
6+
<a href="{{ url('admin/users/all') }}"><button>Manage users</button></a>
7+
<br><br>
8+
</x-guest-layout>

0 commit comments

Comments
 (0)