From d46d6d57137a86012c80ba43a217ad789972bc70 Mon Sep 17 00:00:00 2001 From: Derek Date: Tue, 12 May 2020 12:41:27 -0400 Subject: [PATCH] Add Telescope::avatar() example --- telescope.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/telescope.md b/telescope.md index 3ec392c90a5..3717557ee9e 100644 --- a/telescope.md +++ b/telescope.md @@ -26,6 +26,7 @@ - [Redis Watcher](#redis-watcher) - [Request Watcher](#request-watcher) - [Schedule Watcher](#schedule-watcher) +- [Displaying User Avatars](#displaying-user-avatars) ## Introduction @@ -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. + + +## 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; + }); + }