@extends('layouts.app') @section('title', 'Messages') @section('styles') @endsection @section('content') @if(session('success'))
✓ {{ session('success') }}
@endif

Messages

+ Add Demo Chats
@if($conversations->count() > 0)
@foreach($conversations as $conversation) @php $otherUser = $conversation->getOtherUser($user->id); $unreadCount = $conversation->unreadCount($user->id); $latestMessage = $conversation->latestMessage; @endphp
@if($otherUser->avatar ?? false) {{ $otherUser->name }} @else {{ substr($otherUser->name ?? 'U', 0, 1) }} @endif
{{ $otherUser->name ?? 'Unknown' }} {{ $conversation->last_message_at ? $conversation->last_message_at->diffForHumans(null, true) : '' }}
{{ $latestMessage ? Str::limit($latestMessage->content, 40) : 'No messages yet' }}
@if($conversation->ride) 🚗 {{ $conversation->ride->route->fromCity->name ?? '' }} → {{ $conversation->ride->route->toCity->name ?? '' }} @endif
@if($unreadCount > 0) {{ $unreadCount }} @endif
@endforeach
@else
💬

No Messages Yet

Start a conversation with drivers or passengers

Create Demo Chats
@endif @endsection