Skip to content

Commit 25422a8

Browse files
authored
fix: limit user initials to two characters to prevent avatar overflow (#95)
1 parent cc26030 commit 25422a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/Models/User.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ public function initials(): string
5454
{
5555
return Str::of($this->name)
5656
->explode(' ')
57-
->map(fn (string $name) => Str::of($name)->substr(0, 1))
57+
->take(2)
58+
->map(fn ($word) => Str::substr($word, 0, 1))
5859
->implode('');
5960
}
6061
}

0 commit comments

Comments
 (0)