@extends('layouts.app') @push('styles') @endpush @section('content')
@if($conversations->count() > 0)
@foreach($conversations as $conversation)
@if($conversation['user']->profile_photo_url) {{ $conversation['user']->name }} @else
{{ strtoupper(substr($conversation['user']->name, 0, 1)) }}
@endif

{{ $conversation['user']->name }}

@if($conversation['last_message']) {{ $conversation['last_message']->created_at->diffForHumans(null, true) }} @endif
@if($conversation['last_message'])

@if($conversation['last_message']->sender_id === Auth::id()) Vous: @endif {{ Str::limit($conversation['last_message']->content ?: '📷 Photo', 45) }}

@else

Nouvelle conversation

@endif
@if($conversation['unread_count'] > 0)
{{ $conversation['unread_count'] }}
@endif
@endforeach
@else

Aucune conversation

Commencez à échanger avec {{ Auth::user()->role === 'client' ? 'des prestataires' : 'des clients' }} pour voir vos messages ici.

@if(Auth::user()->role === 'client') Trouver des prestataires @endif
@endif
@endsection