vouchers = auth()->user()->vouchers()->get()->map(fn ($voucher) => [ 'id' => $voucher->id, 'name' => $voucher->name, 'code' => $voucher->code, 'is_percentage' => $voucher->type == VoucherType::PERCENTAGE, 'min_purchase' => $voucher->min_purchase ? currency($voucher->min_purchase, 'Rp') : 'No Min. Belanja', 'discount_amount' => $voucher->type == VoucherType::PERCENTAGE ? $voucher->discount_amount.'%' : currency($voucher->discount_amount, 'Rp'), 'max_discount' => currency($voucher->max_discount, 'Rp'), 'end_date' => $voucher->end_date ? timeAgo($voucher->end_date) : 'Tidak Ada Batas Waktu', ])->toArray(); } public function render() { return view('livewire.member.voucher', [ 'pageTitle' => 'Voucher', ]); } }