feat: Integrate saade/filament-facehash for avatar management in User model and Filament admin panel, enhancing user experience with customizable avatars.
This commit is contained in:
parent
db386f455d
commit
afefc57b75
@ -11,11 +11,12 @@
|
|||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Saade\FilamentFacehash\Concerns\HasFacehashAvatar;
|
||||||
use Spatie\Permission\Traits\HasRoles;
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
class User extends Authenticatable implements FilamentUser
|
class User extends Authenticatable implements FilamentUser
|
||||||
{
|
{
|
||||||
use HasFactory, HasRoles, Notifiable, SoftDeletes;
|
use HasFacehashAvatar, HasFactory, HasRoles, Notifiable, SoftDeletes;
|
||||||
|
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,9 @@
|
|||||||
use Illuminate\Routing\Middleware\SubstituteBindings;
|
use Illuminate\Routing\Middleware\SubstituteBindings;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
use Saade\Facehash\Enums\Variant;
|
||||||
|
use Saade\FilamentFacehash\FacehashPlugin;
|
||||||
|
use Saade\FilamentFacehash\FacehashProvider;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
@ -68,6 +71,18 @@ public function panel(Panel $panel): Panel
|
|||||||
->formPanelPosition('left')
|
->formPanelPosition('left')
|
||||||
->formPanelWidth('40%')
|
->formPanelWidth('40%')
|
||||||
->emptyPanelBackgroundImageUrl(asset('images/login.jpg')),
|
->emptyPanelBackgroundImageUrl(asset('images/login.jpg')),
|
||||||
|
|
||||||
|
FacehashPlugin::make()
|
||||||
|
->size(40)
|
||||||
|
->variant(Variant::Gradient)
|
||||||
|
->initial(true)
|
||||||
|
->colors([
|
||||||
|
'#ec4899',
|
||||||
|
'#f59e0b',
|
||||||
|
'#3b82f6',
|
||||||
|
'#f97316',
|
||||||
|
'#10b981',
|
||||||
|
]),
|
||||||
])
|
])
|
||||||
->navigationGroups([
|
->navigationGroups([
|
||||||
'Master',
|
'Master',
|
||||||
@ -78,6 +93,7 @@ public function panel(Panel $panel): Panel
|
|||||||
'Sistem',
|
'Sistem',
|
||||||
])
|
])
|
||||||
->breadcrumbs(false)
|
->breadcrumbs(false)
|
||||||
->globalSearch(false);
|
->globalSearch(false)
|
||||||
|
->defaultAvatarProvider(FacehashProvider::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,8 @@
|
|||||||
"husam-tariq/filament-timepicker": "^4.0",
|
"husam-tariq/filament-timepicker": "^4.0",
|
||||||
"laravel/framework": "^12.0",
|
"laravel/framework": "^12.0",
|
||||||
"laravel/tinker": "^2.10.1",
|
"laravel/tinker": "^2.10.1",
|
||||||
"predis/predis": "^3.4"
|
"predis/predis": "^3.4",
|
||||||
|
"saade/filament-facehash": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fakerphp/faker": "^1.23",
|
"fakerphp/faker": "^1.23",
|
||||||
|
|||||||
126
composer.lock
generated
126
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "56130ed23ae07742e1cd21275e38ca34",
|
"content-hash": "8f136168f1eda0d995ad666c928ef3d1",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "akaunting/laravel-money",
|
"name": "akaunting/laravel-money",
|
||||||
@ -5790,6 +5790,130 @@
|
|||||||
],
|
],
|
||||||
"time": "2025-02-25T09:09:36+00:00"
|
"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",
|
"name": "scrivo/highlight.php",
|
||||||
"version": "v9.18.1.10",
|
"version": "v9.18.1.10",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user