Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| VerifyEmailController | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| __invoke | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers\Auth; |
| 4 | |
| 5 | use App\Http\Controllers\Controller; |
| 6 | use Illuminate\Auth\Events\Verified; |
| 7 | use Illuminate\Foundation\Auth\EmailVerificationRequest; |
| 8 | use Illuminate\Http\RedirectResponse; |
| 9 | |
| 10 | class VerifyEmailController extends Controller |
| 11 | { |
| 12 | /** |
| 13 | * Mark the authenticated user's email address as verified. |
| 14 | */ |
| 15 | public function __invoke(EmailVerificationRequest $request): RedirectResponse |
| 16 | { |
| 17 | if ($request->user()->hasVerifiedEmail()) { |
| 18 | return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); |
| 19 | } |
| 20 | if ($request->user()->markEmailAsVerified()) { |
| 21 | /** @phpstan-ignore-next-line */ |
| 22 | event(new Verified($request->user())); |
| 23 | } |
| 24 | |
| 25 | return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); |
| 26 | } |
| 27 | } |