@extends ('admin.layouts.default') @section ('main')

@php echo (isset($post)) ? __('labels.post.edit_post') : __('labels.post.create_post'); @endphp

@include('admin.partials.x-toolbar') @php $action = (isset($post)) ? route('admin.posts.update', $query) : route('admin.posts.store', $query) @endphp
@csrf @if (isset($post)) @method('put') @endif @php $value = (isset($post)) ? old('title', $fields[0]->value) : old('title'); @endphp @php array_shift($fields); // Remove the very first field (ie: title) from the array. @endphp
@php $dataTab = null; $dateFormats = []; @endphp @foreach ($fields as $key => $field) @if (isset($field->tab)) @php $active = ($field->tab == 'details') ? 'show active' : ''; $dataTab = $field->tab; @endphp
@endif @if (isset($field->dataset)) @php $field->dataset->tab = $dataTab; @endphp @else @php $dataset = (object) ['tab' => $dataTab]; $field->dataset = $dataset; @endphp @endif @php $value = (isset($post) || str_starts_with($field->name, 'alias_extra_field_')) ? old($field->name, $field->value) : old($field->name); @endphp @if ($field->name == 'locale') @php $value = $locale; @endphp @endif @if ($field->name == 'image')
@php $path = (isset($post) && $post->image) ? url('/').$post->image->getThumbnailUrl() : asset('/images/camera.png'); @endphp
@endif @if ($field->name == 'page')
@endif @if ($field->type == 'date' && isset($field->format)) @php $dateFormats[$field->name] = $field->format; @endphp @endif @if (!next($fields) || isset($fields[$key + 1]->tab))
@endif @endforeach
@if (isset($post)) @endif @foreach ($dateFormats as $key => $value) @endforeach @if (isset($post))
@method('delete') @csrf
@method('delete') @csrf
@method('delete') @csrf
@endif @endsection @push ('style') @endpush @push ('scripts') @endpush