@extends('student.layouts.app') @section('title', app()->getLocale() === 'ar' ? 'المحادثات' : 'Chat') @section('content') @php $isArabic = app()->getLocale() === 'ar'; @endphp
{{-- قائمة المحادثات --}}

{{ $isArabic ? 'المحادثات' : 'Conversations' }}

@forelse($conversations as $conv)
{{ mb_substr($conv->name, 0, 1) }}
{{ $conv->name }} @if($conv->unread > 0) {{ $conv->unread }} @endif
@if($conv->last_message)

{{ $conv->last_message }}

@endif
@empty

{{ $isArabic ? 'لا توجد محادثات' : 'No conversations' }}

@endforelse
{{-- نافذة الرسائل --}}
{{-- رأس المحادثة --}}
{{ mb_substr($otherUser->name, 0, 1) }}

{{ $otherUser->name }}

{{ $isArabic ? ucfirst($otherUser->type) : ucfirst($otherUser->type) }}

{{-- منطقة الرسائل --}}
@foreach($messages as $msg)

{{ $msg->message }}

{{ $msg->created_at->format('H:i') }}

@endforeach {{-- رسائل Alpine.js الجديدة --}}
{{-- حقل الإرسال --}}
@endsection