@php // مرفقات كل السندات المعروضة في الصفحة (استعلام واحد) حتى يظهر المرفق في كل أسطر السند $pageVouchers = (isset($data) && count($data) > 0) ? collect(method_exists($data, 'items') ? $data->items() : $data)->pluck('sent_abd_count')->filter()->unique()->values() : collect(); $voucherAttachments = $pageVouchers->isEmpty() ? collect() : App\Models\credittransactions::whereIn('sent_abd_count', $pageVouchers) ->whereNotNull('attachments')->where('attachments', '!=', '') ->get(['sent_abd_count', 'attachments']) ->groupBy('sent_abd_count') ->map(fn ($rows) => $rows->pluck('attachments')->unique()->values()); @endphp