Undefined index: password in EloquentUserProvider laravel

3.56K 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

[php]

public function LoginAuth_Method(){
$credentials = [‘entity_email’=>’customlaravel_login@sdtuts.com’,’entity_password’=>’ThePassword!!’];
$studentAuth = auth()->guard(‘mycustomGaurd’);
$studentAuth->attempt($credentials);
}
[/php]

Just you have to change key from entity_password to password and define it custom entity_password into CustomLoginModel

[php]
class CustomLoginModel extends Authenticatable{
public function getAuthPassword(){
            return $this->entity_password;
}
}
[/php]

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>