2

In my database password column name is "new_password". then when I try to log, it says Undefined index: password. But if password column name is "password" it works properly. I need to use previous column name.

How can I fix this?

$credentials = array(
        'user_name'    => Input::get('username'),
        'new_password' => Input::get('password')
);

$user = Auth::attempt($credentials);
Thisaru
  • 301
  • 3
  • 15
  • 1
    Possible duplicate of [Laravel: How can i change the default Auth Password field name](https://stackoverflow.com/questions/39374472/laravel-how-can-i-change-the-default-auth-password-field-name) – Andriy Lozynskiy Jun 10 '18 at 19:50

1 Answers1

-1

Hello, Thisaru If you need to use your password field as new_password

1) First thing is laravel password field by default set password into your model. So If you change the password as new_password add this line in your Model

 protected $primaryKey = 'new_password';

I hope this code help to solve your problem

Amit Senjaliya
  • 2,867
  • 1
  • 10
  • 24