Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

1.2 KB
Raw Blame
<?php

namespace HiEvents\Resources\CheckInList;

use HiEvents\DomainObjects\AttendeeCheckInDomainObject;
use HiEvents\Resources\Attendee\AttendeeResource;
use Illuminate\Http\Resources\Json\JsonResource;

/**
 * @mixin AttendeeCheckInDomainObject
 */
class AttendeeCheckInResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => $this->getId(),
            'attendee_id' => $this->getAttendeeId(),
            'check_in_list_id' => $this->getCheckInListId(),
            'product_id' => $this->getProductId(),
            'event_id' => $this->getEventId(),
            'event_occurrence_id' => $this->getEventOccurrenceId(),
            'short_id' => $this->getShortId(),
            'created_at' => $this->getCreatedAt(),
            'check_in_list' => $this->when(
                ! is_null($this->getCheckInList()),
                fn () => (new CheckInListResource($this->getCheckInList()))->toArray($request)
            ),
            'attendee' => $this->when(
                ! is_null($this->getAttendee()),
                fn () => (new AttendeeResource($this->getAttendee()))->toArray($request)
            ),
        ];
    }
}