Skip to content

Telescope avatar is not displayed if user doesn't have email #1564

Open
@lukas-pierce

Description

@lukas-pierce

Telescope Version

5.3.0

Laravel Version

11

PHP Version

8.2

Database Driver & Version

mysql Ver 8.3.0 for macos14 on arm64 (MySQL Community Server - GPL)

Description

In my Laravel application, users do not have emails. Authorization is done via username + password

Therefore, to display user avatars, I decided to use a custom callback function as described in the documentation.
https://laravel.com/docs/11.x/telescope#displaying-user-avatars

Telescope::avatar(function (string $id, string $email) {
    return '/avatars/'.User::find($id)->avatar_path;
});

But this doesn't work because there is a check for the existence of the user's email

So need to swap blocks because lack of email blocks my callback

Image

Steps To Reproduce

No need additional steps

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions