Medicine
@forelse ($medicines as $medicine) @php $brand = $medicine->brands->first(); $batches = $medicine->brands->flatMap->batches; $stock = $batches->sum('quantity'); $nextExpiry = $batches->where('quantity', '>', 0)->sortBy('exp_date')->first(); @endphp @empty @endforelse
Medicine Brand Category Stock Expiry Actions

{{ $medicine->generic_name }} {{ $medicine->strength }}

{{ $medicine->therapeutic_class }} - {{ $medicine->requires_rx ? 'Rx' : 'OTC' }}

{{ $brand?->brand_name ?? 'No brand' }} {{ $medicine->category }} {{ $stock }} {{ $nextExpiry?->exp_date?->format('d M Y') ?? 'No batch' }}
@csrf @method('DELETE')
No medicines found.
{{ $medicines->links() }}