WiP
This commit is contained in:
@@ -22,9 +22,19 @@ class EventParticipantResource extends JsonResource
|
||||
$amountLeft->subtractAmount($this->resource->amount_paid);
|
||||
}
|
||||
|
||||
$presenceDays = $this->resource->arrival_date->diff($this->resource->departure_date)->days;
|
||||
$presenceDaysSupport = $presenceDays;
|
||||
|
||||
if ($presenceDaysSupport === 0) {
|
||||
$presenceDaysSupport = 1;
|
||||
} else {
|
||||
$presenceDaysSupport = $presenceDaysSupport - 1;
|
||||
}
|
||||
|
||||
return array_merge(
|
||||
$this->resource->toArray(),
|
||||
[
|
||||
'presenceDays' => ['real' => $presenceDays, 'support' => $presenceDaysSupport],
|
||||
'participationType' => ParticipationType::where(['slug' => $this->resource->participation_type])->first()->name,
|
||||
'needs_payment' => $this->resource->amount->getAmount() > 0 && $event->pay_direct,
|
||||
'nicename' => $this->resource->getNicename(),
|
||||
|
||||
Reference in New Issue
Block a user