feat: integrate Filament Facehash plugin for user avatars and update admin panel primary color to gray.

This commit is contained in:
Yoga Pangestu 2026-03-10 10:54:48 +07:00
parent 4864d7a8b3
commit c3e2fa501f
4 changed files with 145 additions and 3 deletions

View File

@ -6,9 +6,12 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Saade\FilamentFacehash\Concerns\HasFacehashAvatar;
class User extends Authenticatable
{
use HasFacehashAvatar;
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;

View File

@ -20,6 +20,8 @@
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use Saade\Facehash\Enums\Variant;
use Saade\FilamentFacehash\FacehashPlugin;
class AdminPanelProvider extends PanelProvider
{
@ -32,7 +34,7 @@ public function panel(Panel $panel): Panel
->viteTheme('resources/css/filament/admin/theme.css')
->login(Login::class)
->colors([
'primary' => Color::Amber,
'primary' => Color::Gray,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')
@ -63,6 +65,18 @@ public function panel(Panel $panel): Panel
->formPanelPosition('left')
->formPanelWidth('40%')
->emptyPanelBackgroundImageUrl('https://images.pexels.com/photos/267885/pexels-photo-267885.jpeg'),
FacehashPlugin::make()
->size(40)
->variant(Variant::Gradient)
->initial(true)
->colors([
'#ec4899',
'#f59e0b',
'#3b82f6',
'#f97316',
'#10b981',
]),
]);
}
}

View File

@ -10,7 +10,8 @@
"diogogpinto/filament-auth-ui-enhancer": "^2.0",
"filament/filament": "^5.0",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1"
"laravel/tinker": "^2.10.1",
"saade/filament-facehash": "^1.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",

126
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5870a93ac00fa6b4cbafec3ade70b29d",
"content-hash": "9f13a192915e7241f4c8602810a2e8d3",
"packages": [
{
"name": "anourvalar/eloquent-serialize",
@ -5149,6 +5149,130 @@
],
"time": "2025-02-25T09:09:36+00:00"
},
{
"name": "saade/facehash",
"version": "v1.1.0",
"source": {
"type": "git",
"url": "https://github.com/saade/facehash.git",
"reference": "89d6e1284352413f5a115afbedf442e7fb95128b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/saade/facehash/zipball/89d6e1284352413f5a115afbedf442e7fb95128b",
"reference": "89d6e1284352413f5a115afbedf442e7fb95128b",
"shasum": ""
},
"require": {
"illuminate/support": "^11.0|^12.0",
"php": "^8.2"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"Facehash": "Saade\\Facehash\\Facades\\Facehash"
},
"providers": [
"Saade\\Facehash\\FacehashServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Saade\\Facehash\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Deterministic avatar faces from any string. Lightweight, pure SVG output. Laravel integration.",
"keywords": [
"avatar",
"deterministic",
"facehash",
"identicon",
"laravel",
"svg"
],
"support": {
"issues": "https://github.com/saade/facehash/issues",
"source": "https://github.com/saade/facehash/tree/v1.1.0"
},
"funding": [
{
"url": "https://github.com/saade",
"type": "github"
}
],
"time": "2026-02-18T16:55:54+00:00"
},
{
"name": "saade/filament-facehash",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/saade/filament-facehash.git",
"reference": "d41c416514ab9a0e54cb1fa2fa1b145893cd5d91"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/saade/filament-facehash/zipball/d41c416514ab9a0e54cb1fa2fa1b145893cd5d91",
"reference": "d41c416514ab9a0e54cb1fa2fa1b145893cd5d91",
"shasum": ""
},
"require": {
"filament/filament": "^3.0|^4.0|^5.0",
"php": "^8.2",
"saade/facehash": "^1.0",
"spatie/laravel-package-tools": "^1.15"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Saade\\FilamentFacehash\\FacehashServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Saade\\FilamentFacehash\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Saade",
"role": "Developer"
}
],
"description": "Use Facehash as the default avatar provider in your Filament panels.",
"keywords": [
"avatar",
"deterministic",
"facehash",
"filament",
"filamentphp",
"laravel",
"svg"
],
"support": {
"issues": "https://github.com/saade/filament-facehash/issues",
"source": "https://github.com/saade/filament-facehash/tree/v1.0.0"
},
"funding": [
{
"url": "https://github.com/saade",
"type": "github"
}
],
"time": "2026-02-17T22:08:12+00:00"
},
{
"name": "scrivo/highlight.php",
"version": "v9.18.1.10",