This commit is contained in:
glovetleong
2022-02-16 15:09:52 +08:00
parent cee0f99dc9
commit efc5811403
7 changed files with 91 additions and 7 deletions
+1
View File
@@ -28,6 +28,7 @@ class CompanyResource extends JsonResource
{
$lastPayment = $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->orderBy('id', 'DESC')->first();
$totalPayments = $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
return [
'id' => $this->id,
'name' => $this->name,