protected function getLocalizationTabs(): array { $localizations = $this->record->localizations; $tabs = []; $data = []; foreach ($localizations as $localization) { $data[$localization->id]['body'] = $localization->body; $data[$localization->id]['title'] = $localization->title; $data[$localization->id]['locale'] = $localization->locale; $tabs[] = Forms\Components\Tabs\Tab::make($localization->locale ?? 'New Localization') ->schema([ Forms\Components\TextInput::make("localizations.$localization->id.locale") ->label('Localization') ->required(), Forms\Components\TextInput::make("localizations.$localization->id.title") ->label('Title') ->required(), Forms\Components\Textarea::make("localizations.$localization->id.body") ->label('Body') ->required(), ]); } $this->data['localizations'] = $data; $tabs[] = Forms\Components\Tabs\Tab::make('New Localization') ->schema([ Forms\Components\TextInput::make("new_localization.locale") ->label('Localization') ->required(), Forms\Components\TextInput::make("new_localization.title") ->label('Title') ->required(), Forms\Components\Textarea::make("new_localization.body") ->label('Body') ->required(), ]); return $tabs; }