Undefined index error occurred when you are using custom login with custom columns default #laravel use password column eg: you have defined column just like entity_password in database and you have passed in $credential array for auth()->guard();
This is wrong for login auth
public function LoginAuth_Method(){ $credentials = ['entity_email'=>'customlaravel_login@sdtuts.com','entity_password'=>'ThePassword!!']; $studentAuth = auth()->guard('mycustomGaurd'); $studentAuth->attempt($credentials); }
Just you have to change key from entity_password to password and define it custom entity_password into CustomLoginModel
class CustomLoginModel extends Authenticatable{ public function getAuthPassword(){ return $this->entity_password; } }