@php $hasChildren = $allQuestions->where('parent_id', $question->id)->whereNotNull('question_type')->count() > 0; $isAccordion = is_null($question->question_type) && $hasChildren; @endphp