Support the ongoing development of Laravel.io →
Requests Session Validation
Last updated 1 year ago.
0

You just change the array keys in Auth::attempt(), though I don't know if you can change the password field.

Last updated 1 year ago.
0

If I understand you right, you might be able to use an accessor in your User.php model:

public function getNameAttribute()
    {
        return $this->attributes['your_custom_name_field'];
    }
Last updated 1 year ago.
0

theotherbenjohnson said:

If I understand you right, you might be able to use an accessor in your User.php model:

public function getNameAttribute() { return $this->attributes['your_custom_name_field']; }

That won't work, since the Eloquent auth driver checks the DB for the user based on the array key in attempt.

In your user model, change the getAuthPassword function to return "$this->Password". And in your Auth::attempt() code, you'll still need to specify the password field as 'password' with a lowercase "p". That should work.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Joe96 joe96 Joined 28 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.