dealhub/app/Services/ProfileInitialsService.php
kusowl 193913dfad fix: controller namespaces
- change 'auth' to Auth
- fix use statements to correctly
2026-01-22 17:38:50 +05:30

22 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('');
}
}