{{-- Template partiel pour un commentaire --}}
@if($comment['author_type'] === 'worker' && $comment['author_id'] == auth()->id()) @endif
@if($comment['author_type'] === 'worker') @php // Extraire les initiales du nom de l'auteur $nameParts = explode(' ', $comment['author']); $initials = ''; foreach ($nameParts as $part) { if (!empty($part)) { $initials .= mb_substr($part, 0, 1, 'UTF-8'); } } // Limiter à 2 caractères maximum $initials = mb_substr($initials, 0, 2, 'UTF-8'); @endphp {{ $initials }} @else @endif
{{ $comment['author'] }} {{ $comment['author_type'] === 'worker' ? 'Intervenant' : 'Administrateur' }} {{ isset($comment['date']) ? \Carbon\Carbon::parse($comment['date'])->diffForHumans() : 'À l\'instant' }}
{{ $comment['text'] }}