@extends('layouts.user') @section('sidebar') @include('frontend.components.user-layout-sidebar') @endsection @section('content')

{{$user_name}}

Recent

@foreach (\App\Models\Admin::get() as $user) @php $last_chat = @\App\Models\ChatMessage::where('admin_id', $user->id) ->where('user_id', \Auth::user()->id) ->orderBy('created_at', 'DESC') ->first(); @endphp @endforeach
@foreach (\App\Models\ChatMessage::where('admin_id', @$_GET['admin_id'])->where('user_id', \Auth::user()->id)->get() as $chat) @if ($chat->sent_from != \Auth::user()->id)
sunil

{{ $chat->message }}

{{ $chat->created_at->diffForHumans() }}
@endif @if ($chat->sent_from == \Auth::user()->id)

{{ $chat->message }}

{{ $chat->created_at->diffForHumans() }}
@endif @endforeach
@if(@$_GET['admin_id'])
@csrf
@endif
@endsection