0

I am trying to authenticate the using using ajax and laravel 5.6 authenticate() method. If I pass 'email' and 'password' parameters then it works fine but If I change the email parameter to user_email then it gives me validation that "Email field is required". So I need help to authenticate the user using different parameters (like user_email etc.) instead of email and password.

Here is the code file path app\Http\Controllers\AUth\LoginController.php

protected function authenticate(Request $request, $user){
     if(!request->ajax()){
          return response()->json([
            'auth' => auth()->check(),
            'user' => $user,
            'intented' => $this->redirectPath()
          ]);
     }
}

Thank you

Ahmar Arshad
  • 477
  • 1
  • 10
  • 22

1 Answers1

0

Paste this on your login controller

public function username()
{
    return 'user_email';
}