[
@foreach($template->elements as $field)
    [
        'name' => '{{ $field->name }}',
        'field_type' => '{{ $field->field_type }}',
        @if(!empty($field->element_id))
        'element_id' => ContentElement::query()->where('slug', '{{ $field->element?->slug }}')->first()?->id,
        @elseif(!empty($field->global_content_id))
            'global_id' => GlobalContent::query()->where('slug', '{{ $field->globalContent?->slug }}')->first()?->id,
        @endif
        'data' => '{!! json_encode($field['data']) !!}',
        'meta' => '{!! json_encode($field['meta']) !!}',
    ],
@endforeach
]
