app/Http/Controllers/Admin/LoginsController.php
// LOG THE ADMIN & REDIRECT TO  DASHBOARD
LOG THE ADMIN & REDIRECT TO  DASHBOARD
LOG THE ADMIN & REDIRECT TO DASHBOARD
public function login(LoginRequest $request)
    {
        try {
            $rememberMe = $request->has('remember-me')? true: false;
            if (
                Auth::guard('admin')->attempt([
                    'email'     => $request->input('email'),        
                    'password'  => $request->input('password')      
                ])
            ) {
                return redirect()->route('admin.dashboard');
            }
            return redirect()->back()->with([
                'error' => 'No such admin'
            ]);
        } catch (\Throwable $th) {
            return redirect()->route('admin.dashboard')->with([
                'error' => 'Something went terribly wrong'
            ]);
        }
    }
public function login ( LoginRequest $ request ) { try { $ rememberMe = $ request -> has ( 'remember-me' ) ? true : false ; if ( Auth :: guard ( 'admin' ) -> attempt ( [ 'email' => $ request -> input ( 'email' ) , 'password' => $ request -> input ( 'password' ) ] ) ) { return redirect ( ) -> route ( 'admin.dashboard' ) ; } return redirect ( ) -> back ( ) -> with ( [ 'error' => 'No such admin' ] ) ; } catch ( \ Throwable $ th ) { return redirect ( ) -> route ( 'admin.dashboard' ) -> with ( [ 'error' => 'Something went terribly wrong' ] ) ; } }
LOG THE ADMIN & REDIRECT TO  DASHBOARD
LOG THE ADMIN & REDIRECT TO DASHBOARD
// REMEMBER ME CHECKBOX // EMAIL & PASSWORD DB EXISTANCE CHECK // AUTHORIZED ADMIN GUARDED CHECK // auth()->guard('admin')->attempt([ // ADMIN EMAIL // ADMIN PASSWORD // REDIRECT TO ADMIN DASHBOARD VIEW // REDIRECT BACK TO LOGIN PAGE WITH ERROR MESSAGE // REDIRECT TO ADMIN BACK WITH ERROR MESSAGE