Http/Controllers/SecurityController.php
public function prosesLogin(UserFormLoginRequest $request)
    {
        // print_r($request->all());
        $users = User::where('email', $request->get('username'))->where('password',$request->get('password'))->get();
        if($users->count() > 0){
            Auth::login($users->first());
            return redirect()->intended();
            
            return redirect()->to('/')->with("message", ['alert'=> 'success', 'message'=> 'Welcome '.$users->first()->name.'.'. ' You successfully logged in.']);
        }
        return redirect()->back()->with("message", ['alert'=> 'danger', 'message'=> 'Combination Username and Password is not match']);
    }
public function prosesLogin(UserFormLoginRequest $request)
    {
        // print_r($request->all());
        $users = User::where('email', $request->get('username'))->where('password',$request->get('password'))->get();
        if($users->count() > 0){
            Auth::login($users->first());
            return redirect()->intended();
            
            return redirect()->to('/')->with("message", ['alert'=> 'success', 'message'=> 'Welcome '.$users->first()->name.'.'. ' You successfully logged in.']);
        }
        return redirect()->back()->with("message", ['alert'=> 'danger', 'message'=> 'Combination Username and Password is not match']);
    }
public function prosesLogin ( UserFormLoginRequest $ request ) { // print_r($request->all()); $ users = User :: where ( 'email' , $ request -> get ( 'username' ) ) -> where ( 'password' , $ request -> get ( 'password' ) ) -> get ( ) ; if ( $ users -> count ( ) > 0 ) { Auth :: login ( $ users -> first ( ) ) ; return redirect ( ) -> intended ( ) ; return redirect ( ) -> to ( '/' ) -> with ( "message" , [ 'alert' => 'success' , 'message' => 'Welcome ' . $ users -> first ( ) -> name . '.' . ' You successfully logged in.' ] ) ; } return redirect ( ) -> back ( ) -> with ( "message" , [ 'alert' => 'danger' , 'message' => 'Combination Username and Password is not match' ] ) ; }
This method uses to check the user credential
@param  UserFormLoginRequest $request Request
@return redirect                      Response
This method uses to check the user credential