no name in user database in laravel

anderson-so

Jun 23rd, 2017 04:42 AM

Hello,

I have edited the default laravel users database and changed the name to username... is there any config or file I can edit because now it cannot show the name of the user since I renamed the DB.

Thank you.

mark

Jun 28th, 2017 09:39 AM

In your user object, add this:

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

This will return the username when someone tries to get the name like this echo $user->name;