update api and add more features
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Fees;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ChargeActionResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return array_filter([
|
||||
'ok' => (bool) ($this->resource['ok'] ?? false),
|
||||
'charge_type' => $this->resource['charge_type'] ?? null,
|
||||
'id' => isset($this->resource['id']) ? (int) $this->resource['id'] : null,
|
||||
'parent_id' => isset($this->resource['parent_id']) ? (int) $this->resource['parent_id'] : null,
|
||||
'student_id' => isset($this->resource['student_id']) ? (int) $this->resource['student_id'] : null,
|
||||
'invoice_id' => isset($this->resource['invoice_id']) ? (int) $this->resource['invoice_id'] : null,
|
||||
'event_id' => isset($this->resource['event_id']) ? (int) $this->resource['event_id'] : null,
|
||||
'event_name' => $this->resource['event_name'] ?? null,
|
||||
'amount' => isset($this->resource['amount']) ? (float) $this->resource['amount'] : null,
|
||||
'status' => $this->resource['status'] ?? null,
|
||||
'payment_status' => $this->resource['payment_status'] ?? null,
|
||||
'participation_status' => $this->resource['participation_status'] ?? null,
|
||||
'cancellation_status' => $this->resource['cancellation_status'] ?? null,
|
||||
'account_credit_charge_id' => isset($this->resource['account_credit_charge_id'])
|
||||
? (int) $this->resource['account_credit_charge_id']
|
||||
: null,
|
||||
'message' => $this->resource['message'] ?? null,
|
||||
'error' => $this->resource['error'] ?? null,
|
||||
], fn ($value) => $value !== null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user