<?php

namespace Overdrive\Web\Http\Controllers\Auth;

use Overdrive\Web\Http\Requests\Auth\LoginRequest;
use Overdrive\Web\Providers\RouteServiceProvider;
use Illuminate\Routing\Controller;

class LoginController extends Controller
{
    /**
     * Display the login view.
     *
     * @return \Illuminate\Contracts\View\View
     */
    public function show()
    {
        return view('web::auth.login');
    }

    /**
     * Handle an incoming authentication request.
     *
     * @param  \App\Http\Requests\Auth\LoginRequest  $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function store(LoginRequest $request)
    {
        // dd('sini');
        $request->authenticate();

        $request->session()->regenerate();

        return redirect()->intended(RouteServiceProvider::HOME);
    }
}
