@props([ 'user', 'size' => 'md', ]) @php $sizeClass = match($size) { 'sm' => 'w-8 h-8 text-xs', 'lg' => 'w-16 h-16 text-xl', default => 'w-10 h-10 text-sm', }; $initials = collect(explode(' ', trim($user->full_name ?? ''))) ->filter() ->take(2) ->map(fn ($part) => substr($part, 0, 1)) ->join(''); $initials = strtoupper($initials ?: 'U'); @endphp @if($user->avatar_url) {{ $user->full_name }}merge(['class' => "rounded-full object-cover shrink-0 {$sizeClass}"]) }} /> @else
merge(['class' => "rounded-full bg-primary-100 text-primary-700 flex items-center justify-center font-semibold shrink-0 {$sizeClass}"]) }}> {{ $initials }}
@endif