@extends('layouts.app') @section('title', 'Messages') @section('content')

My Messages

{{ $conversations->count() }} conversation(s)

Back to Dashboard
@forelse ($conversations as $conversation) @php $otherParticipant = $conversation->participants->where('id', '!=', auth()->id())->first(); $lastMessage = $conversation->messages->first(); @endphp
{{ $otherParticipant->name }}

{{ $otherParticipant->name ?? 'Healthcare Worker' }}

{{ $conversation->updated_at->diffForHumans() }}

{{ $conversation->subject ?? 'Conversation' }}

@if ($lastMessage)

{{ $lastMessage->sender_id === auth()->id() ? 'You' : $otherParticipant->name }}: {{ \Illuminate\Support\Str::limit($lastMessage->body, 60) }}

@else

No messages yet

@endif
@empty

No conversations yet

Connect with other healthcare workers to start messaging

Find Healthcare Workers
@endforelse
@endsection