@forelse($medicineHistory->groupBy(function($medicine){
return $medicine->created_at->format('Y-m-d');
}) as $date => $medicines)
@php
$reuseMedicines = [];
foreach ($medicines as $medicine) {
$reuseMedicines[] = [
'category_id' => $medicine->product->category_id ?? '',
'category_name' => optional(optional($medicine->product)->category)->name ?? '-',
'product_id' => $medicine->product_id ?? '',
'product_name' => optional($medicine->product)->product_name ?? '-',
'dosage' => $medicine->dosage,
'days' => $medicine->days,
'morning' => $medicine->morning ? 1 : 0,
'lunch' => $medicine->lunch ? 1 : 0,
'evening' => $medicine->evening ? 1 : 0,
'dinner' => $medicine->dinner ? 1 : 0,
'before_food' => $medicine->before_food ? 1 : 0,
'after_food' => $medicine->after_food ? 1 : 0,
'note' => $medicine->note ?? '',
];
}
@endphp
@empty
{{ \Carbon\Carbon::parse($date)->format('d M Y') }}
@foreach($medicines as $medicine)
{{ $medicine->product->product_name ?? 'N/A' }}
@endforeach
No medicine history found.
@endforelse