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.
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?
Please or to participate in this conversation.