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

595 B
Raw Blame
<?php

namespace HiEvents\Services\Domain\Tax;

use HiEvents\Repository\Interfaces\TaxAndFeeRepositoryInterface;

class DuplicateTaxService
{
    private TaxAndFeeRepositoryInterface $taxRepository;

    public function __construct(TaxAndFeeRepositoryInterface $taxRepository)
    {
        $this->taxRepository = $taxRepository;
    }

    public function isDuplicate(string $name, int $accountId): bool
    {
        $existing = $this->taxRepository->findWhere([
            'name' => $name,
            'account_id' => $accountId,
        ]);

        return $existing->isNotEmpty();
    }
}