blackbirdchess-server/app/Http/Controllers/Auth/EmailVerificationNotificationController.php

27 lines
716 B
PHP
Raw Permalink Normal View History

2023-02-01 17:10:21 +01:00
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*/
public function store(Request $request): JsonResponse|RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME);
}
$request->user()->sendEmailVerificationNotification();
return response()->json(['status' => 'verification-link-sent']);
}
}