jorge_dev96
4 months ago
521
4
Laravel

User model doesn't recognize new attributes

Posted 4 months ago by jorge_dev96

I created my users table with php artisan make:auth and I modified the original migration adding username attribute, but when I try to select a username it doesn't work

        $users = User::select('name','username')->where('username', 'LIKE', '%'.$request->input('username').'%')->get();

I get this

      {message: "Undefined property: ILink\User::$username", exception: "ErrorException",…}
protected $fillable = [
        'name','username', 'email', 'password','profile_image'
    ];

but username is actually in $fillable array

Please sign in or create an account to participate in this conversation.