29 lines
1.2 KiB
PHP
29 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Finance;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class FinancialUnpaidParentResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'parent_id' => (int) ($this->resource['parent_id'] ?? 0),
|
|
'parent_name' => $this->resource['parent_name'] ?? null,
|
|
'email' => $this->resource['email'] ?? null,
|
|
'total_invoice' => (float) ($this->resource['total_invoice'] ?? 0),
|
|
'total_balance' => (float) ($this->resource['total_balance'] ?? 0),
|
|
'total_discount' => (float) ($this->resource['total_discount'] ?? 0),
|
|
'remaining_installments' => (int) ($this->resource['remaining_installments'] ?? 0),
|
|
'installment_amount' => (float) ($this->resource['installment_amount'] ?? 0),
|
|
'type' => $this->resource['type'] ?? null,
|
|
'total_paid' => (float) ($this->resource['total_paid'] ?? 0),
|
|
'payment_count' => (int) ($this->resource['payment_count'] ?? 0),
|
|
'has_installment' => (int) ($this->resource['has_installment'] ?? 0),
|
|
'next_installment' => $this->resource['next_installment'] ?? null,
|
|
];
|
|
}
|
|
}
|