PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Unsolved

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;