Skip to content

Commit 8ae4030

Browse files
authored
Merge pull request #127 from devmount/enhancements/replace-ui-avatar
Replace ui-avatars with svg data-url
2 parents 7408e55 + ac7f9c1 commit 8ae4030

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

app/Models/User.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace App\Models;
44

5-
// use Illuminate\Contracts\Auth\MustVerifyEmail;
65
use Filament\Models\Contracts\FilamentUser;
6+
use Filament\Models\Contracts\HasAvatar;
77
use Filament\Panel;
88
use Illuminate\Database\Eloquent\Factories\HasFactory;
99
use Illuminate\Foundation\Auth\User as Authenticatable;
1010
use Illuminate\Notifications\Notifiable;
1111
use Laravel\Sanctum\HasApiTokens;
1212

13-
class User extends Authenticatable implements FilamentUser
13+
class User extends Authenticatable implements FilamentUser, HasAvatar
1414
{
1515
use HasApiTokens, HasFactory, Notifiable;
1616

@@ -50,4 +50,16 @@ public function canAccessPanel(Panel $panel): bool
5050
// TODO: limit to defined domains
5151
return $this->hasVerifiedEmail();
5252
}
53+
54+
public function getFilamentAvatarUrl(): ?string
55+
{
56+
return 'data:image/svg+xml;utf8,' . <<<HTML
57+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="gray" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
58+
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
59+
<path d="M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" />
60+
<path d="M12 10m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" />
61+
<path d="M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855" />
62+
</svg>
63+
HTML;
64+
}
5365
}

0 commit comments

Comments
 (0)