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 ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
namespace HiEvents\Services\Application\Handlers\EmailTemplate;
use HiEvents\Repository\Interfaces\EmailTemplateRepositoryInterface;
use HiEvents\Services\Application\Handlers\EmailTemplate\DTO\GetEmailTemplatesDTO;
use Illuminate\Support\Collection;
class GetEmailTemplatesHandler
{
public function __construct(
private readonly EmailTemplateRepositoryInterface $emailTemplateRepository
) {}
public function handle(GetEmailTemplatesDTO $dto): Collection
{
$conditions = [
'account_id' => $dto->account_id,
];
if ($dto->event_id) {
$conditions['event_id'] = $dto->event_id;
}
if ($dto->organizer_id) {
$conditions['organizer_id'] = $dto->organizer_id;
}
if ($dto->template_type) {
$conditions['template_type'] = $dto->template_type->value;
}
if (! $dto->include_inactive) {
$conditions['is_active'] = true;
}
return $this->emailTemplateRepository->findWhere($conditions);
}
}