mengatasi diskon dalam pisau php laravel

 @if($invoice->promo != null)
   <div class="d-flex keep-print-font">
   <p class="text-left h4 fw-700 keep-print-font mr-4">
   Promo Discount
   </p>
   <p class="text-left h4 fw-700 keep-print-font">
 {{ number_format($invoice->promo->amount,3) }} KD
   @if($invoice->promo->type == "percentage")
   @php
   $discount_amount += ($sub_total+$sum_addon)/100*$invoice->promo->amount;
@endphp
  @else
  @php
  $discount_amount += $invoice->promo->amount ;
@endphp
  @endif
  </p>
  </div>
  @else
  <div class="d-flex keep-print-font">
  <p class="text-left h4 fw-700 keep-print-font mr-4">
  Discount
  </p>
  <p class="text-left h4 fw-700 keep-print-font">
{{ number_format($discount_amount,3) }} KD
{{-- {{ number_format($sum_addon,3) ?? '' }} KD --}}
</p>
  </div>
  @endif
Bloody Buffalo