How to write custom and simple login code in laravel?

we are writing the code 
  
 I Have written the Custom  Login API in laravel .  
This is a simple process :

Create logincomponent and use Auth and validation in your component
Create a Model that you want to use this
 
    public function adminLogin(Request $request) { 
        $this->validateLogin($request);
       
        $data = $request->all();
      
        if (Auth::attempt(['email' => $data['email'], 'password' => $data['password'], 'role_type' => 1])) {
  
       
            return redirect()->route('admin/dashboard');
           
        }
  
        
        //dd($request);
        return $this->sendFailedLoginResponse($request);<br>
    }

  
  
first we have create the adminlogin funtion. then get the request value store the data variable
  check the condition behalf of your login panel in above code we have check the user user email id password and role_type
  
  all feild are belong to your database
How to write custom and simple login code in laravel? How to write custom and simple login code in laravel? Reviewed by Bugs Solutions on December 12, 2020 Rating: 5

2 comments