You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to propose an enhancement to the current functionality of the component. Currently, prepositions such as "de" or "das" in full names are included in the component's display. I suggest that these prepositions be excluded, and the preference be given to displaying the initials of the first and last names.
Current Behavior:
For example, with the name "Maria das Graças Rodrigues," the current display is "Md."
Desired Behavior:
I propose that the display exclude prepositions, resulting in "MR" for the same name. Additionally, the function should respect the desired length for the displayed initials.
Implementation Suggestion:
To implement this enhancement, I recommend updating the getInitialFromMultipleWords function in the laravolt/avatar/src/Generator/DefaultGenerator.php file as follows:
protectedfunctiongetInitialFromMultipleWords($words, $length)
{
// Get the first letter of the first name$firstInitial = Str::substr($words->first(), 0, 1);
// Get the first letter of the last name$lastInitial = Str::substr($words->last(), 0, 1);
// Concatenate the initials and limit the length according to the $length variable$result = $firstInitial . $lastInitial;
returnStr::substr($result, 0, $length);
}
It's important to note that, despite the existence of the $length parameter, the function currently returns only two initials: the first and last names. Adjustments are needed to accommodate the desired variable length for initials.
The text was updated successfully, but these errors were encountered:
I would like to propose an enhancement to the current functionality of the component. Currently, prepositions such as "de" or "das" in full names are included in the component's display. I suggest that these prepositions be excluded, and the preference be given to displaying the initials of the first and last names.
Current Behavior:
For example, with the name "Maria das Graças Rodrigues," the current display is "Md."
Desired Behavior:
I propose that the display exclude prepositions, resulting in "MR" for the same name. Additionally, the function should respect the desired length for the displayed initials.
Implementation Suggestion:
To implement this enhancement, I recommend updating the
getInitialFromMultipleWords
function in thelaravolt/avatar/src/Generator/DefaultGenerator.php
file as follows:It's important to note that, despite the existence of the
$length
parameter, the function currently returns only two initials: the first and last names. Adjustments are needed to accommodate the desired variable length for initials.The text was updated successfully, but these errors were encountered: