Skip to content

Commit 7d1df16

Browse files
[12.x] Nullsafe operator (#10304)
* Nullsafe operator * Update telescope.md * Update telescope.md --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent c22c311 commit 7d1df16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

telescope.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ public function register(): void
475475
// ...
476476

477477
Telescope::avatar(function (?string $id, ?string $email) {
478-
return '/avatars/'.User::find($id)->avatar_path;
478+
return ! is_null($id)
479+
? '/avatars/'.User::find($id)->avatar_path
480+
: '/generic-avatar.jpg';
479481
});
480482
}
481483
```

0 commit comments

Comments
 (0)