@php
$model = $model ?? null;
$component = $component ?? 'input';
$type = $type ?? 'text';
$required = $required ?? false;
$rows = $rows ?? 4;
$namePrefix = $namePrefix ?? null;
$oldPrefix = $oldPrefix ?? null;
$values = collect($values ?? []);
$isEnabled = \App\Support\Multilingual::enabled();
$locales = \App\Support\Multilingual::locales();
$defaultLocale = \App\Support\Multilingual::defaultLocale();
$inputName = fn (string $name) => $namePrefix ? $namePrefix . '[' . $name . ']' : $name;
$oldKey = fn (string $name) => $oldPrefix ? $oldPrefix . '.' . $name : $name;
$translatedValue = fn (string $name, string $locale) => old(
$oldKey($name . '_' . $locale),
$values->get($name . '_' . $locale, $model?->translation($name, $locale))
);
$activeLocale = old($oldKey($field . '_active_locale'), $defaultLocale);
$activeLocale = array_key_exists($activeLocale, $locales) ? $activeLocale : $defaultLocale;
$groupId = 'translatable_' . $field . '_' . \Illuminate\Support\Str::random(8);
@endphp
@if($component === 'textarea')
@include('admin.partials.richbox-assets')
@endif
@if(! $isEnabled)
@if($component === 'textarea')