Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,

],
],

Expand All @@ -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

Expand Down
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
{
"name": "EL OUFIR Hatim",
"email": "[email protected]"
},
{
"name": "Der Schuessi [ Christoph Schüßler @ solisTEC ]",
"email": "[email protected]",
"homepage": "https://solistec.de",
"role": "Contributor"
}
],
"extra": {
Expand Down
5 changes: 4 additions & 1 deletion config/filament-avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
],

Expand Down
1 change: 1 addition & 0 deletions src/Core/GravatarProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down