'datetime', 'password' => 'hashed', 'created_at' => JalaliDatetime::class, 'updated_at' => JalaliDatetime::class, ]; } public function getFilamentAvatarUrl(): ?string { $name = $this->name ?? $this->username ?? '?'; $initials = $this->getAvatarInitials($name); $color = $this->getAvatarColor($name); $svg = '' . '' . '' . $initials . '' . ''; return 'data:image/svg+xml;base64,' . base64_encode($svg); } private function getAvatarInitials(string $name): string { $words = preg_split('/\s+/', trim($name)); if (count($words) >= 2) { return mb_substr($words[0], 0, 1) . mb_substr($words[1], 0, 1); } return mb_substr($name, 0, 2); } private function getAvatarColor(string $name): string { $colors = ['#4F46E5', '#7C3AED', '#2563EB', '#0891B2', '#059669', '#D97706', '#DC2626', '#0F766E']; $index = abs(crc32($name) % count($colors)); return $colors[$index]; } }