lk-students/app/Http/Controllers/Auth/VerifyEmailController.php

28 lines
804 B
PHP
Raw Permalink Normal View History

2024-06-19 13:42:36 +03:00
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\RedirectResponse;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*/
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
2024-06-19 16:40:34 +03:00
return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
2024-06-19 13:42:36 +03:00
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
2024-06-19 16:40:34 +03:00
return redirect()->intended(route('dashboard', absolute: false) . '?verified=1');
2024-06-19 13:42:36 +03:00
}
}