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

Add Telescope::avatar() example #6048

Merged
merged 1 commit into from
May 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions telescope.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- [Redis Watcher](#redis-watcher)
- [Request Watcher](#request-watcher)
- [Schedule Watcher](#schedule-watcher)
- [Displaying User Avatars](#displaying-user-avatars)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -351,3 +352,22 @@ The request watcher records the request, headers, session, and response data ass
### Schedule Watcher

The schedule watcher records the command and output of any scheduled tasks run by your application.

<a name="displaying-user-avatars"></a>
## Displaying User Avatars

The Telescope dashboard will display which authenticated user was logged in when the entry was saved. By default, Telescope will lookup a profile avatar using web service Gravatar. You may customize this avatar by registering a callback in your `TelescopeServiceProvider`. It should return an image URL from the authenticated user ID and email address passed to the callback.

use App\User;

/**
* Register any application services.
*
* @return void
*/
public function register()
{
Telescope::avatar(function ($id, $email) {
return '/avatars/' . User::find($id)->avatar_path;
});
}