dealhub/app/Services/ProfileInitialsService.php
kusowl 94ef8f360d feature (favorite and reported deals):
- add favorites and reported tabs in user profile pages
- add remove favorites
- customers can view a deal directly from profiles section and deal modal is shown in explore page
- fix formatting by pint
2026-01-23 16:14:04 +05:30

21 lines
459 B
PHP

<?php
namespace App\Services;
use Illuminate\Support\Str;
class ProfileInitialsService
{
/**
* Create the initials from a full name (e.g. John Doe, Alex Mark, jane clerk)
* to display on the profile page (e.g. JD, AM, JC).
*/
public function create(string $fullname)
{
return Str::of($fullname)
->explode(' ')
->map(fn ($word) => Str::substr(ucfirst($word), 0, 1))
->join('');
}
}