app/maguttiCms/Admin/Controllers/AuthController.php
/**
     * This method is used to authenticate an admin.
     *
     * @return $this|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
     */
This method is used to authenticate an admin.
This method is used to authenticate an admin .
public function adminLogin()
    {
        $input = Input::all();
        if (count($input) > 0) {
            $auth = auth()->guard('admin');
            $credentials = [
                'email'    => $input['email'],
                'password' => $input['password'],
            ];
            if ($auth->attempt($credentials)) {
                if ($auth->user()->is_active == 1)
                    return redirect()->action('\App\maguttiCms\Admin\Controllers\AdminPagesController@home');
                else {
                    Auth::guard('admin')->logout();
                    return redirect()->back()->withErrors([
                        'unauthorized' => Lang::has('auth.unauthorized') ? Lang::get('auth.unauthorized') : 'You are not authorized to proceed.',
                    ]);
                }
            } else {
                return redirect()->back()
                    ->withInput(Input::only('username', 'password'))
                    ->withErrors([
                        $this->loginUsername() => $this->getFailedLoginMessage(),
                    ]);
            }
        } else {
            return view('admin.login');
        }
    }
public function adminLogin ( ) { $ input = Input :: all ( ) ; if ( count ( $ input ) > 0 ) { $ auth = auth ( ) -> guard ( 'admin' ) ; $ credentials = [ 'email' => $ input [ 'email' ] , 'password' => $ input [ 'password' ] , ] ; if ( $ auth -> attempt ( $ credentials ) ) { if ( $ auth -> user ( ) -> is_active == 1 ) return redirect ( ) -> action ( '\App\maguttiCms\Admin\Controllers\AdminPagesController@home' ) ; else { Auth :: guard ( 'admin' ) -> logout ( ) ; return redirect ( ) -> back ( ) -> withErrors ( [ 'unauthorized' => Lang :: has ( 'auth.unauthorized' ) ? Lang :: get ( 'auth.unauthorized' ) : 'You are not authorized to proceed.' , ] ) ; } } else { return redirect ( ) -> back ( ) -> withInput ( Input :: only ( 'username' , 'password' ) ) -> withErrors ( [ $ this -> loginUsername ( ) => $ this -> getFailedLoginMessage ( ) , ] ) ; } } else { return view ( 'admin.login' ) ; } }
This method is used to authenticate an admin.
This method is used to authenticate an admin .
// Make sure that the user is authorized.