Available Sections
@if (isset($sections) && $sections->count() > 0)
@foreach ($sections as $section)
@php
$settings = json_decode($section->settings ?? '{}', true);
$totalCategory = $settings['total_category'] ?? 0;
$totalWidgets = $settings['total_widgets'] ?? 0;
$totalAds = $settings['total_ads'] ?? 0;
$isAdsSection = $settings['is_ads_section'] ?? false;
@endphp
@endforeach
@else
{{ $section->display_name }}
@if ($isAdsSection)
Ads
@endif
@if (!empty($section->image))
@endif
@if ($isAdsSection)
@else
@endif
@if ($totalCategory > 0 && isset($categories))
@endif
No sections available.
@endif
Home Page Sections
@if (isset($layouts) && $layouts->count() > 0)
@foreach ($layouts as $layout)
@php
$sectionSettings = json_decode($layout->section->settings ?? '{}', true);
$layoutSettings = json_decode($layout->settings ?? '{}', true);
if (is_string($layoutSettings)) {
$layoutSettings = json_decode($layoutSettings, true) ?? [];
}
$isAdsSection = $sectionSettings['is_ads_section'] ?? false;
$totalCategory = $sectionSettings['total_category'] ?? 0;
$totalWidgets = $sectionSettings['total_widgets'] ?? 0;
$totalAds = $sectionSettings['total_ads'] ?? 0;
$orderedCategoryIds = $layoutSettings['assign_category'] ?? [];
$orderedCategories = collect();
foreach ($orderedCategoryIds as $catId) {
$category = $layout->categories->firstWhere('id', $catId);
if ($category) {
$orderedCategories->push($category);
}
}
$isEnabled = $layout->status ? 1 : 0;
@endphp
@endforeach
@else
@endif
@if (!$isAdsSection && $orderedCategories->count() > 0)
@foreach($orderedCategories as $cat)
{{ $cat->name }}
@endforeach
{{ $layout->section->display_name ?? 'Section' }}
{{ $totalCategory }}C | {{ $totalWidgets }}W | {{ $totalAds }}A
@else
{{ $layout->section->display_name ?? 'Section' }}
@endif
@if ($isAdsSection)
Ads
@endif
{{ $isEnabled ? 'Active' : 'Disabled' }}
@if (!empty($layout->section->image))
@endif
@if ($isAdsSection)
@php $selectedAdId = $layoutSettings['ads_id'] ?? null; @endphp
@else
@endif
@if ($totalCategory > 0 && isset($categories))
@endif
Drag sections from the left panel to build your home page layout