Signup for events implemented

This commit is contained in:
2026-03-22 00:06:03 +01:00
parent b8341890d3
commit 405591d6dd
13 changed files with 428 additions and 24 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Resources;
use App\Enumerations\ParticipationType;
use App\Models\EventParticipant;
use Illuminate\Http\Resources\Json\JsonResource;
@@ -16,16 +17,23 @@ class EventParticipantResource extends JsonResource
{
$event = $this->resource->event;
$amountLeft = $this->resource->amount;
if ($this->resource->amount_paid !== null) {
$amountLeft->subtractAmount($this->resource->amount_paid);
}
return array_merge(
$this->resource->toArray(),
[
'participationType' => ParticipationType::where(['slug' => $this->resource->participation_type])->first()->name,
'needs_payment' => $this->resource->amount->getAmount() > 0 && $event->pay_direct,
'nicename' => $this->resource->getNicename(),
'arrival' => $this->resource->arrival_date->format('d.m.Y'),
'departure' => $this->resource->departure_date->format('d.m.Y'),
'amount_left_string' => $this->resource->amount->toString(),
'amount_left_string' => $amountLeft->toString(),
'amount_left_value' => $amountLeft->getAmount(),
'email_1' => $this->resource->email_1,
]
);