Basic signup for events
This commit is contained in:
33
app/Resources/EventParticipantResource.php
Normal file
33
app/Resources/EventParticipantResource.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Resources;
|
||||
|
||||
use App\Models\EventParticipant;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class EventParticipantResource extends JsonResource
|
||||
{
|
||||
function __construct(EventParticipant $participant)
|
||||
{
|
||||
parent::__construct($participant);
|
||||
}
|
||||
|
||||
public function toArray($request) : array
|
||||
{
|
||||
$event = $this->resource->event;
|
||||
|
||||
|
||||
|
||||
return array_merge(
|
||||
$this->resource->toArray(),
|
||||
[
|
||||
'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(),
|
||||
]
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user