Undefined index: password in EloquentUserProvider laravel

1.13K views
no comments
6 Oct 2017 1:42 am

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;
	}
}

NOTE:Your Email Address will be not shown and please do not add spamming comments because here is REL="NOFOLLOW" on your links and comments also moderated shown.
<code>Put html css or any language code under this tag</code>