@php
$dt = "";
foreach($allMsgs as $msg){
if (date("Y-m-d", strtotime($msg->ent_dt)) == date("Y-m-d")) {
$tme = "Today";
} else {
//$tme = date('F d, Y', strtotime($msg->ent_dt));
$tme = date('d-m-Y', strtotime($msg->ent_dt));
}
if (date("Y-m-d", strtotime($msg->ent_dt)) == date('Y-m-d', strtotime("-1 days"))) {
$tme = "Yesterday";
}
if($dt != date("d-m-Y",strtotime($msg->ent_dt))){
@endphp
{{ $tme }}
@php
$dt = date("d-m-Y",strtotime($msg->ent_dt));
}
$old = DB::table('tm_msg')->select('*')->where('id',$msg->old_id)->where('display','Y')->get();
if(count($old) > 0){
$old_msg = $old[0]->msg;
}
if($msg->from_id != Auth::user()->id){
$to_id = $msg->to_id;
$to_id = explode('@', $to_id);
$strname = "";
for($i=0; $i < count($to_id); $i++){
$res = DB::table("users")->where('id',$to_id[$i])->select('name')->get();
if (!empty($res[0])) {
$fname = ucwords(strtolower(strtok($res[0]->name, " ")));
$strname = $fname.", ".$strname;
}
}
$strname = rtrim($strname, ", ");
@endphp
@php
$strname = "";
}else{
$to_id = $msg->to_id;
if($to_id != '0'){
// echo "true";
$to_id = explode('@', $to_id);
$strname = "";
for($i=0; $i < count($to_id); $i++){
$res = DB::table("users")->where('id',$to_id[$i])->select('name')->get();
if (!empty($res[0])) {
$fname = ucwords(strtolower(strtok($res[0]->name, " ")));
$strname = $fname.", ".$strname;
}
}
$strname = rtrim($strname, ", ");
}else{
// echo "false";
$strname = "";
}
//exit();
@endphp
@php
}
}
@endphp