]> git.localhorst.tv Git - alttp.git/blob - app/Http/Controllers/Auth/VerifyEmailController.php
add discord auth
[alttp.git] / app / Http / Controllers / Auth / VerifyEmailController.php
1 <?php
2
3 namespace App\Http\Controllers\Auth;
4
5 use App\Http\Controllers\Controller;
6 use App\Providers\RouteServiceProvider;
7 use Illuminate\Auth\Events\Verified;
8 use Illuminate\Foundation\Auth\EmailVerificationRequest;
9
10 class VerifyEmailController extends Controller
11 {
12     /**
13      * Mark the authenticated user's email address as verified.
14      *
15      * @param  \Illuminate\Foundation\Auth\EmailVerificationRequest  $request
16      * @return \Illuminate\Http\RedirectResponse
17      */
18     public function __invoke(EmailVerificationRequest $request)
19     {
20         if ($request->user()->hasVerifiedEmail()) {
21             return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
22         }
23
24         if ($request->user()->markEmailAsVerified()) {
25             event(new Verified($request->user()));
26         }
27
28         return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
29     }
30 }