Edit File: FinancialResource.php
<?php namespace App\Http\Resources\Api\Delegate\Settlement; use App\Enums\OrderPayType; use Carbon\Carbon; use Illuminate\Http\Resources\Json\JsonResource; class FinancialResource extends JsonResource { public function toArray($request) { $isOrderPayWithCash = $this->pay_type == OrderPayType::CASH->value; return [ 'id' => $this->id, 'order_num' => $this->order_num, 'total' => number_format($this->total_products, 2), 'delivery_price' => number_format($this->delivery_price, 2), 'delegate_due_amount' => number_format($this->delegate_due_amount, 2), 'admin_commission_value' => number_format($this->admin_commission_value, 2), 'vat_amount' => number_format($this->vat_amount, 2), 'final_total' => number_format($this->final_total, 2), 'has_indebtedness' => $isOrderPayWithCash, 'indebtedness' => $isOrderPayWithCash ? number_format($this->final_total - $this->delegate_due_amount, 2) : (string) 0, 'pay_type_text' => $this?->pay_type_text, 'created_at' => Carbon::parse($this->created_at)->diffForHumans(), 'currency' => __('apis.r_s'), ]; } }
Back to File Manager