Skip to content

Commit bdef8d0

Browse files
committed
Try direct github avatar
1 parent 38f7a13 commit bdef8d0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

app/Models/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ public function bio(): string
102102
return $this->bio;
103103
}
104104

105+
public function githubId(): ?string
106+
{
107+
return $this->github_id;
108+
}
109+
105110
public function githubUsername(): string
106111
{
107112
return $this->github_username ?? '';

resources/views/components/avatar.blade.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
])
55

66
<?php
7-
$src = $user->githubUsername()
8-
? sprintf('https://unavatar.io/github/%s?%s', $user->githubUsername(), http_build_query([
9-
'fallback' => asset('https://laravel.io/images/laravelio-icon-gray.svg'),
10-
]))
7+
$src = $user->githubId()
8+
? sprintf('https://avatars.githubusercontent.com/u/%s', $user->githubId())
119
: asset('https://laravel.io/images/laravelio-icon-gray.svg');
1210
?>
1311

0 commit comments

Comments
 (0)