Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hapiiis's avatar

Filament user avatar not showing

I've tried to do the exact thing like the filament documentation and the user avatar image not showing. Here's my code in User Model :

use Filament\Models\Contracts\HasAvatar;

class User extends Authenticatable implements HasAvatar
{
    use HasApiTokens, HasFactory, Notifiable, HasRoles;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $guarded = [
        'id'
    ];

    /**
     * The attributes that should be hidden for serialization.
     *
     * @var array<int, string>
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array<string, string>
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
        'password' => 'hashed',
    ];

    public function getFilamentAvatarUrl(): ?string
    {
        return $this->photo;
    }
}
0 likes
3 replies
aurawindsurfing's avatar

Hi @hapiiis

return $this->photo;

Needs to return probably the full correct path to the image. What do you store in your database? Just a filename? If so then it needs to be full path. That path should open your avatar if you paste it into the browser directly - thats the easiest way to check if it works.

Hope it helps!

jaseofspades88's avatar

Using filament's default image storage solution, I found the following to work in my User model as the images are stored via simlink.

public function getFilamentAvatarUrl(): ?string
{
    return asset($this->avatar_url);//replace with $this->photo
}

Please or to participate in this conversation.