@php $text = $article->content_json; if (strlen($text) > 0) { $objects = json_decode($text); } else { $objects = []; } $count = 0; @endphp @if (count($objects) > 0)
Table of contents
@foreach ($objects as $k => $obj)
@if ($obj->name == 'h2') @php $count++; @endphp @elseif($obj->name == 'h3') @endif
@endforeach
@endif