Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lukas-pierce opened this issue Jan 29, 2025 · 2 comments
Open

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

lukas-pierce opened this issue Jan 29, 2025 · 2 comments

Comments

@lukas-pierce
Copy link

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

@lukas-pierce
Copy link
Author

Also needs to be fixed here so that the absence of email turns into null

Image


And of course fix the documentation on the Laravel website
by making the second parameter in the example a nullable string

Image

Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants