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

972 B
Raw Blame
<?php

declare(strict_types=1);

namespace HiEvents\Enterprise\Licensing\Http\Actions;

use HiEvents\Enterprise\Licensing\LicenceService;
use HiEvents\Enterprise\Licensing\LicenceStatus;
use HiEvents\Enterprise\Licensing\LicensedFeature;
use HiEvents\Enterprise\Licensing\LicensedFeatureUsageService;
use HiEvents\Http\Actions\BaseAction;
use Illuminate\Http\JsonResponse;

class GetInstanceInfoPublicAction extends BaseAction
{
    public function __construct(
        private readonly LicenceService $licenceService,
        private readonly LicensedFeatureUsageService $featureUsageService,
    ) {}

    public function __invoke(): JsonResponse
    {
        return $this->jsonResponse([
            'white_label' => $this->licenceService->allows(LicensedFeature::WHITE_LABEL),
            'dev_mode' => $this->licenceService->status() === LicenceStatus::DEV
                && $this->featureUsageService->featuresInUse() !== [],
        ], wrapInData: true);
    }
}