add controllers, servoices
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Reimbursements;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ReimbursementResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) ($this->resource['id'] ?? $this->resource->id ?? 0),
|
||||
'expense_id' => isset($this->resource['expense_id']) ? (int) $this->resource['expense_id'] : (int) ($this->resource->expense_id ?? 0),
|
||||
'amount' => (float) ($this->resource['amount'] ?? $this->resource->amount ?? 0),
|
||||
'reimbursed_to' => isset($this->resource['reimbursed_to']) ? (int) $this->resource['reimbursed_to'] : (int) ($this->resource->reimbursed_to ?? 0),
|
||||
'description' => $this->resource['description'] ?? $this->resource->description ?? null,
|
||||
'status' => $this->resource['status'] ?? $this->resource->status ?? null,
|
||||
'reimbursement_method' => $this->resource['reimbursement_method'] ?? $this->resource->reimbursement_method ?? null,
|
||||
'check_number' => $this->resource['check_number'] ?? $this->resource->check_number ?? null,
|
||||
'receipt_path' => $this->resource['receipt_path'] ?? $this->resource->receipt_path ?? null,
|
||||
'receipt_url' => $this->resource['receipt_url'] ?? null,
|
||||
'school_year' => $this->resource['school_year'] ?? $this->resource->school_year ?? null,
|
||||
'semester' => $this->resource['semester'] ?? $this->resource->semester ?? null,
|
||||
'batch_number' => isset($this->resource['batch_number']) ? (int) $this->resource['batch_number'] : (int) ($this->resource->batch_number ?? 0),
|
||||
'created_at' => $this->resource['created_at'] ?? $this->resource->created_at ?? null,
|
||||
'updated_at' => $this->resource['updated_at'] ?? $this->resource->updated_at ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user