#75 - new colors

This commit is contained in:
Adrian Hopek
2022-03-16 09:42:17 +01:00
parent 894a1468b2
commit 7261c82c57
3 changed files with 82 additions and 18 deletions

View File

@@ -16,6 +16,7 @@ use Illuminate\Support\Collection;
use Rackbeat\UIAvatars\HasAvatar;
use Toby\Domain\Enums\EmploymentForm;
use Toby\Domain\Enums\Role;
use Toby\Eloquent\Helpers\ColorGenerator;
/**
* @property int $id
@@ -84,10 +85,8 @@ class User extends Authenticatable
public function getAvatar(): string
{
$colors = config("colors");
return $this->getAvatarGenerator()
->backgroundColor($colors[strlen($this->fullname) % count($colors)])
->backgroundColor(ColorGenerator::generate($this->fullName))
->image();
}