This commit is contained in:
Linksehat Staging Server
2024-06-19 11:01:13 +07:00
parent 3fcaa6a4be
commit 721e318997

View File

@@ -86,6 +86,9 @@ class ChatController extends Controller
foreach($dataChannel as $d){ foreach($dataChannel as $d){
$user = User::with('detail')->where('nID', $d['member_id'])->first(); $user = User::with('detail')->where('nID', $d['member_id'])->first();
$lastMessage = Message::where('channel_id', $d['id']) $lastMessage = Message::where('channel_id', $d['id'])
->where('type', '!=', 'summary')
->where('type', '!=', 'trigger')
->latest('created_at') ->latest('created_at')
->first(); ->first();
$urlAvatarDefault = $user->detail->nIDJenisKelamin == 1 ? 'https://linksehat.dev/assets/img/users/male-avatar.png' : 'https://linksehat.dev/assets/img/users/female-avatar.png'; $urlAvatarDefault = $user->detail->nIDJenisKelamin == 1 ? 'https://linksehat.dev/assets/img/users/male-avatar.png' : 'https://linksehat.dev/assets/img/users/female-avatar.png';
@@ -262,9 +265,9 @@ class ChatController extends Controller
} }
$prescription = Prescription::where('livechat_id', $livechat->id)->first(); $prescription = Prescription::where('livechat_id', $livechat->id)->first();
$prescriptionItems = PrescriptionItem::with('drug')->where('prescription_id',$prescription->id)->get();
$prescriptions = []; $prescriptions = [];
if ($prescriptionItems){ if ($prescription){
$prescriptionItems = PrescriptionItem::with('drug')->where('prescription_id',$prescription->id)->get();
foreach($prescriptionItems as $item){ foreach($prescriptionItems as $item){
$row['medicine'] = $item->drug->name; $row['medicine'] = $item->drug->name;
$row['direction'] = $item->direction; $row['direction'] = $item->direction;