where('parent_id', $parentId) ->where('period_year', $year) ->where('period_month', $month) ->where('type', $type) ->first() !== null; } public function listLogs(?string $from = null, ?string $to = null, ?string $type = null): array { $builder = $this->orderBy('sent_at', 'DESC'); if ($from) { $builder->where('sent_at >=', $from); } if ($to) { $builder->where('sent_at <=', $to); } if ($type) { $builder->where('type', $type); } return $builder->findAll(); } }