diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..9e5d8f7 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +# Contributors + +Dieses Projekt wird von folgenden Personen gepflegt und weiterentwickelt: + +- **[Der Schuessi](https://github.com/ChrisSchuessler)** – Fork-Initiator +- **[EL OUFIR Hatim](https://github.com/heloufir)** – Ursprünglicher Ersteller diff --git a/README.md b/README.md index 33d7429..1ffe0fe 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ # Filament Avatar -[![Latest Version on Packagist](https://img.shields.io/packagist/v/devaslanphp/filament-avatar.svg?style=flat-square)](https://packagist.org/packages/devaslanphp/filament-avatar) -[![Total Downloads](https://img.shields.io/packagist/dt/devaslanphp/filament-avatar.svg?style=flat-square)](https://packagist.org/packages/devaslanphp/filament-avatar) - This package provides a complete and customizable User Avatar provider for your Filament project, and also for any project using a User Model. For now the avatar providers implemented are @@ -100,7 +97,11 @@ return [ 'url' => 'https://www.gravatar.com/avatar/', // User's field used to generate avatar - 'name_field' => 'email' + 'name_field' => 'email', + + // Default Gravatar Types => https://docs.gravatar.com/sdk/images/ + 'default_avatar' => false, + ], ], @@ -126,12 +127,12 @@ This trait will give you access to an appended attribute `avatarUrl` generated b ## Support -For fast support, please join the [**Filament** community](https://filamentphp.com/discord) discord and send me a message in this channel [#avatar-provider](https://discord.com/channels/883083792112300104/1022104259644362823) +For fast support, please join the Filament community discord and send me a message in this channel #avatar-provider ## Credits - [heloufir](https://github.com/heloufir) -- [All Contributors](https://github.com/devaslanphp/filament-avatar/graphs/contributors) +- [Der Schuessi @ solisTEC](https://github.com/ChrisSchuessler) as contributor ## License diff --git a/composer.json b/composer.json index ab5c3cc..79ae83a 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,12 @@ { "name": "EL OUFIR Hatim", "email": "eloufirhatim@gmail.com" + }, + { + "name": "Der Schuessi [ Christoph Schüßler @ solisTEC ]", + "email": "chris@solistec.de", + "homepage": "https://solistec.de", + "role": "Contributor" } ], "extra": { diff --git a/config/filament-avatar.php b/config/filament-avatar.php index 0f37f76..4215bc7 100644 --- a/config/filament-avatar.php +++ b/config/filament-avatar.php @@ -57,7 +57,10 @@ 'url' => 'https://www.gravatar.com/avatar/', // User's field used to generate avatar - 'name_field' => 'email' + 'name_field' => 'email', + + // Default Gravatar Types => https://docs.gravatar.com/sdk/images/ + 'default_avatar' => false, ], ], diff --git a/src/Core/GravatarProvider.php b/src/Core/GravatarProvider.php index 12a3c7f..ed70fee 100644 --- a/src/Core/GravatarProvider.php +++ b/src/Core/GravatarProvider.php @@ -17,6 +17,7 @@ class GravatarProvider public function get(Model $user): string { $name = md5($user->{config('filament-avatar.providers.gravatar.name_field')}); + $default = is_null(config('filament-avatar.providers.gravatar.default_avatar')) ? '' : config('filament-avatar.providers.gravatar.default_avatar'); return config('filament-avatar.providers.gravatar.url') . '' . $name; }