@extends('layouts.partials.master') @section('title', 'Menus') @push('styles') @endpush @php $sectionTranslations = collect($allTranslations) ->filter(function ($value, $key) use ($keyStart) { return str_starts_with($key, $keyStart); }) ->flatMap(function ($collection) { return $collection; }); $sectionTranslatable = []; $idToKeyMap = []; foreach ($staticContentSettings->where('type_form', 'string') as $setting) { if (str_starts_with($setting->key, $keyStart)) { $sectionTranslatable[] = [ 'name' => $setting->key, 'type' => 'text', 'label' => $setting->description, 'required' => false ]; $idToKeyMap[$setting->id] = $setting->key; } }; $preparedTranslations = $sectionTranslations->map(function ($translation) use ($idToKeyMap) { if (isset($idToKeyMap[$translation->record_id])) { // Altera a propriedade column_name em tempo de execução $translation->column_name = $idToKeyMap[$translation->record_id]; } return $translation; }); @endphp @section('content')
@include('layouts.components.section-title', ['title' => 'Menus']) Voltar
@include('layouts.components.alerts')
@csrf @method('PUT')
@foreach($menuSettings as $setting)
@endforeach
@if (!\App\Helpers\ModuleHelper::isModuleActive('module_automatic_translations')) @include('layouts.components.translation-edit', [ 'idPrefix' => $keyStart, 'translations' => $preparedTranslations, 'translatable' => $sectionTranslatable ]) @endif
@endsection