outl1ne / nova-notes-field

This Laravel Nova package adds a notes field to Nova's arsenal of fields.
MIT License
51 stars 36 forks source link

use Avatar instead of Gravatar #5

Closed Milkhan closed 4 years ago

Milkhan commented 4 years ago

Thank you for this gorgeous package. It is using the gravatar in the model. But some of us use the Avatar for users instead of Gravatars. If you could make it optional to use the avatar, that would be awesome. Currently, I am changing the model like this:

public function getCreatedByAvatarUrlAttribute() { $createdBy = $this->createdBy; if (empty($createdBy)) return null; //return 'https://www.gravatar.com/avatar/' . md5(strtolower($createdBy->email)) . '?s=300'; return '/storage/' . auth()->user()->avatar . '?s=300'; }

Thank you.

Tarpsvo commented 4 years ago

Hey! Added a config option get_avatar_url which accepts a callable. You can use that to generate an avatar URL using the User model that's passed in.

Released in 1.2.0.

Milkhan commented 4 years ago

Thank you!