@props(['user'])

@php
    $name = $user->name ?? '';
    $initials = strtoupper(substr($name, 0, 2));
@endphp

@if(isset($user->avatar) && $user->avatar)
    <img src="{{ $user->avatar }}" {{ $attributes->merge(['class' => 'w-12 h-12 rounded-full object-cover']) }} />
@else
    <div {{ $attributes->merge(['class' => 'w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center text-gray-600 font-bold']) }}>
        {{ $initials }}
    </div>
@endif
