@extends('templates._single') @section('html.head.title', 'Hello World') @section('main') @include('sections.banner', ['background' => '', 'space_class'=>'pt4 pb3']) @include('atoms.heading_group', $primaryIndex) @include('sections.banner_CLOSE')
{{-- counter for later in the loop --}} @foreach($primaryIndex['index'] as $key => $sub) {{-- render a group section --}} @if(isset($sub['children']))

{{$sub['title']}}

@foreach($sub['children'] as $subKey => $child)

{{$child['title']}}

{{$child['copy']}}

{{-- @include('atoms.resources', [ 'resources' => $primaryIndex['resources']['entities'], 'resource_id' => rand(), 'classes' => 'mr1 -sm' ]) --}}
@if(($subKey % 2) == 1)
@endif @endforeach
@endif {{-- render singleton sections --}} @if(!isset($sub['children'])) {{-- if is first item OR last item had a child then create a container --}} @if(isset($primaryIndex['index'][($key -1)]['children']) || $key == 0)
@endif

{{$sub['title']}}

{{$sub['copy']}}

{{-- @include('atoms.resources', [ 'resources' => $primaryIndex['resources']['entities'], 'resource_id' => rand(), 'classes' => 'mr1 -sm' ]) --}}
@if($count == 2)
@endif {{-- if is last item OR next item has a child then close the container --}} @if(isset($primaryIndex['index'][($key +1)]['children']) || $key == count($primaryIndex['index']) -1)
@endif @endif @endforeach
@endsection