<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;

class AdminLoginController extends Controller
{
    // Menampilkan form login admin
    public function create(): View
    {
        return view('auth.admin-login');
    }

    // Memproses login admin
    public function store(LoginRequest $request): RedirectResponse
    {
        $request->authenticate(); 
        $request->session()->regenerate();
        return redirect()->route('admin.dashboard');
    }
}