37 lines
1.9 KiB
PHP
37 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Reimbursements;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class ReimbursementExpenseResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'expense_id' => (int) ($this->resource['id'] ?? $this->resource['expense_id'] ?? 0),
|
|
'amount' => (float) ($this->resource['amount'] ?? 0),
|
|
'category' => $this->resource['category'] ?? null,
|
|
'description' => $this->resource['description'] ?? null,
|
|
'retailor' => $this->resource['retailor'] ?? null,
|
|
'purchased_by' => $this->resource['purchased_by'] ?? null,
|
|
'expense_receipt_url' => $this->resource['expense_receipt_url'] ?? null,
|
|
'reimbursement_id' => $this->resource['reimb_id'] ?? null,
|
|
'reimbursement_amount' => isset($this->resource['reimb_amount']) ? (float) $this->resource['reimb_amount'] : null,
|
|
'reimbursement_method' => $this->resource['reimbursement_method'] ?? null,
|
|
'check_number' => $this->resource['check_number'] ?? null,
|
|
'reimb_receipt_url' => $this->resource['reimb_receipt_url'] ?? null,
|
|
'reimb_status' => $this->resource['reimb_status'] ?? null,
|
|
'reimbursed_to' => $this->resource['reimb_recipient_id'] ?? null,
|
|
'reimbursed_firstname' => $this->resource['reimb_firstname'] ?? null,
|
|
'reimbursed_lastname' => $this->resource['reimb_lastname'] ?? null,
|
|
'approver_firstname' => $this->resource['approver_firstname'] ?? null,
|
|
'approver_lastname' => $this->resource['approver_lastname'] ?? null,
|
|
'school_year' => $this->resource['school_year'] ?? null,
|
|
'semester' => $this->resource['semester'] ?? null,
|
|
'reimb_created_at' => $this->resource['reimb_created_at'] ?? null,
|
|
];
|
|
}
|
|
}
|