@php $subjectsShow = App\Models\HomepageSetting::get('subjects_show', true); $subjectsLabel = App\Models\HomepageSetting::get('subjects_label', 'POPULAR SUBJECTS'); $subjectsHeading = App\Models\HomepageSetting::get('subjects_heading', 'Top Subjects Across All Syllabuses'); $subjectsSubtext = App\Models\HomepageSetting::get('subjects_subtext', 'Master key syllabus concepts and solve challenging past worksheets with our certified specialists.'); $subjectsTabsShow = App\Models\HomepageSetting::get('subjects_tabs_show', true); $subjectsTabs = App\Models\HomepageSetting::get('subjects_tabs_json', []); $subjectsMode = App\Models\HomepageSetting::get('subjects_mode', 'auto'); $subjectsFeaturedIds = App\Models\HomepageSetting::get('subjects_featured_ids', []); $subjectsLimit = App\Models\HomepageSetting::get('subjects_limit', 8); $subjectsViewAllShow = App\Models\HomepageSetting::get('subjects_viewall_show', true); @endphp @if($subjectsShow)
@if(isset($activeEditingSection) && $activeEditingSection === 'subjects')
Editing: Featured Subjects
@endif
{{ $subjectsLabel }}

{{ $subjectsHeading }}

{{ $subjectsSubtext }}

@php $query = \App\Models\Subject::where('is_active', true)->with(['grade.curriculum']); if ($subjectsMode === 'manual' && !empty($subjectsFeaturedIds)) { $query->whereIn('id', $subjectsFeaturedIds); } $activeSubjects = $query->take($subjectsLimit)->get(); @endphp @if($subjectsTabsShow && !empty($subjectsTabs))
@foreach($subjectsTabs as $tab) @if($tab['visible'] ?? true) @endif @endforeach
@endif
@foreach($activeSubjects as $subject) @php // Map subject categories to tabs $cat = $subject->category ?? 'Other'; if (str_contains(strtolower($subject->name), 'math')) { $cat = 'Mathematics'; } elseif (str_contains(strtolower($subject->name), 'phys') || str_contains(strtolower($subject->name), 'chem') || str_contains(strtolower($subject->name), 'bio') || str_contains(strtolower($subject->name), 'science')) { $cat = 'Sciences'; } elseif (str_contains(strtolower($subject->name), 'history') || str_contains(strtolower($subject->name), 'geography') || str_contains(strtolower($subject->name), 'socio') || str_contains(strtolower($subject->name), 'humanities')) { $cat = 'Humanities'; } elseif (str_contains(strtolower($subject->name), 'english') || str_contains(strtolower($subject->name), 'french') || str_contains(strtolower($subject->name), 'spanish') || str_contains(strtolower($subject->name), 'lang')) { $cat = 'Languages'; } elseif (str_contains(strtolower($subject->name), 'business') || str_contains(strtolower($subject->name), 'econ') || str_contains(strtolower($subject->name), 'account')) { $cat = 'Business'; } @endphp
{{ $subject->grade->curriculum->name ?? 'Syllabus' }} • {{ $subject->grade->name ?? 'Grade' }} {{ $cat }}

{{ $subject->name }}

{{ $subject->description ?? 'Weekly live lessons covering challenging exam papers, syllabus review guides, and core concept building.' }}

@endforeach
@if($subjectsViewAllShow) @endif
@endif