<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class AuthController extends Controller {public function show(){return view('admin.login');} public function login(Request $r){$c=$r->validate(['email'=>'required|email','password'=>'required']); if(auth()->attempt($c,$r->boolean('remember'))){$r->session()->regenerate();return redirect()->route('admin.dashboard');} return back()->withErrors(['email'=>'Invalid credentials'])->onlyInput('email');} public function logout(Request $r){auth()->logout();$r->session()->invalidate();$r->session()->regenerateToken();return redirect()->route('admin.login');}}