diff --git a/lib/qanda_category.php b/lib/qanda_category.php index eff0be3..bc14282 100644 --- a/lib/qanda_category.php +++ b/lib/qanda_category.php @@ -49,4 +49,20 @@ public function find(int $status = 1): ?rex_yform_manager_collection { return qanda::query()->where('status', $status, '>=')->whereListContains('category_ids', $this->getId())->find(); } + + + /** + * Findet alle Fragen, die zu dieser Kategorie gehören. + * Finds all questions that belong to this category. + * + * @return rex_yform_manager_collection|null + * + * Beispiel / Example: + * $questions = $category->getAllQuestions(); + */ + public function getAllQuestions() + { + return qanda::query()->where('status', 0, ">")->whereListContains('category_ids',$this->id) + ->find(); + } }