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 ⭐️

761 B
Raw Blame
<?php

declare(strict_types=1);

namespace HiEvents\Resources\Lineup;

use HiEvents\DomainObjects\EventSpaceDomainObject;
use HiEvents\Resources\BaseResource;
use HiEvents\Resources\Location\LocationPublicResource;
use Illuminate\Http\Request;

/**
 * @mixin EventSpaceDomainObject
 */
class EventSpaceResource extends BaseResource
{
    public function toArray(Request $request): array
    {
        $eventLocation = $this->getEventLocation();
        $location = $eventLocation?->getLocation();

        return [
            'id' => $this->getId(),
            'name' => $this->getName(),
            'event_location_id' => $eventLocation?->getId(),
            'venue' => $location === null ? null : new LocationPublicResource($location),
        ];
    }
}