On this page
Installation
Install Lara Zeus Boredom by running the following commands in your Laravel project directory.
1composer require lara-zeus/boredom
Usage:
set the avatar provider in your panel:
1->defaultAvatarProvider(2 \LaraZeus\Boredom\BoringAvatarsProvider::class3)
register the plugin
1\LaraZeus\Boredom\BoringAvatarPlugin::make()2 ->variant(Variants::MARBLE)3 ->size(60)4 ->square()5 ->colors(['0A0310','49007E','FF005B','FF7D10','FFB238'])
setup your User model
add the trait HasBoringAvatar to your User model:
use HasBoringAvatar;
and you can remove the method getFilamentAvatarUrl
to overwrite the name:
1public function avatarName(): Attribute2{3 return new Attribute(4 get: fn () => $this->name // or $this->>email or $this->>username or Str::random()5 );6}
to get the avatar outside filament:
User::find(1)->avatar_url
to use it in a resource:
ImageColumn::make('avatar_url'),