laravel 8 create custom controller

Solutions on MaxInterview for laravel 8 create custom controller by the best coders in the world

showing results for - "laravel 8 create custom controller"
Leona
13 Jan 2020
1<?php
2namespace App\Http\Controllers;
3
4use Illuminate\Http\Request;
5use Illuminate\Support\Facades\Auth;
6
7class LoginController extends Controller{
8    public function authenticate(Request $request){
9        // Retrive Input
10        $credentials = $request->only('email', 'password');
11
12        if (Auth::attempt($credentials)) {
13            // if success login
14
15            return redirect('berhasil');
16
17            //return redirect()->intended('/details');
18        }
19        // if failed login
20        return redirect('login');
21    }
22}