Enhance Settings and PageController Logic: Updated the SettingForm to include dynamic selection for header and footer templates based on active settings, improving modularity and user experience. Refactored PageController to retrieve active settings for rendering templates, ensuring fallback logic is streamlined and enhancing overall functionality. Updated navbar component to dynamically display social media links from settings, contributing to better localization and user engagement.

This commit is contained in:
Ümit Tunç
2026-01-01 09:55:16 +03:00
parent 3e4fc26e4b
commit 5aa2a3d6e5
5 changed files with 96 additions and 71 deletions
@@ -42,6 +42,7 @@ class SettingForm
->regex('/^[a-z0-9_-]+$/')
->maxLength(255)
->disabled(fn ($record) => $record !== null)
->live(onBlur: true)
->columnSpanFull(),
TextInput::make('label')
@@ -114,10 +115,28 @@ class SettingForm
->label(__('settings.value'))
->helperText(__('settings.value_helper'))
->required()
->visible(fn (Get $get) => in_array($get('type'), ['string', 'text', 'json']))
->visible(fn (Get $get) => in_array($get('type'), ['string', 'text', 'json']) && !in_array($get('key'), ['default_header', 'default_footer']))
->rows(fn (Get $get) => $get('type') === 'text' ? 5 : 3)
->columnSpanFull(),
Select::make('value_header_template')
->label('Default Header Template')
->options(\App\Models\HeaderTemplate::where('is_active', true)->pluck('title', 'id'))
->visible(fn (Get $get) => $get('key') === 'default_header')
->statePath('value')
->searchable()
->preload()
->columnSpanFull(),
Select::make('value_footer_template')
->label('Default Footer Template')
->options(\App\Models\FooterTemplate::where('is_active', true)->pluck('title', 'id'))
->visible(fn (Get $get) => $get('key') === 'default_footer')
->statePath('value')
->searchable()
->preload()
->columnSpanFull(),
Toggle::make('value_boolean')
->label(__('settings.value'))
->helperText(__('settings.value_helper'))