<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
use Illuminate\Http\Request;

class VerificationController extends Controller
{
    use VerifiesEmails;

    // Redirect ke halaman login setelah verifikasi berhasil
    protected function redirectTo()
    {
        return '/login';
    }

    public function __construct()
    {
        $this->middleware('auth');
        $this->middleware('signed')->only('verify');
        $this->middleware('throttle:6,1')->only('verify', 'resend');
    }

    // Tambahan opsional: tampilkan pesan sukses setelah redirect ke login
    public function verified(Request $request)
    {
        return redirect('/login')->with('status', 'Email berhasil diverifikasi. Silakan login.');
    }
}
