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

Vinze's avatar
Level 3

Tag guests with Laravel Telescope

Laravel Telescope automatically tags requests from logged in users with Auth:24 where 24 being the user ID. Now I also want to create a 'Guest' tag for users which are not logged in. So after searching I figured this should be done in the TelescopeServiceProvider.php. In this file I added the following:

public function register(): void
{
    Telescope::tag(function (IncomingEntry $entry) {
        return ! $entry->user ? ['Guest'] : [];
    });
    // ...
}

Unfortunately it looks like the logged in user isn't available yet because $entry->user is always null. Replacing $entry->user with Auth::check() yields the same result. My guess is that the tagging needs to happen somewhere else but I can't figure out where. Any suggestions how to accomplish this?

0 likes
1 reply
okhayat's avatar

Not sure what version of Telescope you are using, but I just tested with the latest version (5.1.1) and $entry->user returns the whole user object.

Please or to participate in this conversation.