Refactor Landing Page Section and Product Form: Removed required validation from several fields in the LandingPageSection schema to enhance flexibility. Updated the ProductForm to enforce required validation on the hero image field, ensuring essential data is captured for product management. Improved localization support by ensuring all labels utilize the translation function.

This commit is contained in:
Ümit Tunç
2026-01-06 21:36:13 +03:00
parent 36471b5965
commit 3a2661cf95
2 changed files with 5 additions and 12 deletions
@@ -107,11 +107,9 @@ class LandingPageSection
Select::make('icon')
->label(__('products.feature_icon'))
->options($iconOptions)
->searchable()
->required(),
->searchable(),
TextInput::make('title')
->label(__('products.feature_title'))
->required()
->columnSpanFull(),
Textarea::make('description')
->label(__('products.feature_description'))
@@ -153,11 +151,9 @@ class LandingPageSection
TextInput::make('number')
->label(__('products.step_number'))
->numeric()
->default(fn ($get) => ($get('../../../_index') ?? 0) + 1)
->required(),
->default(fn ($get) => ($get('../../../_index') ?? 0) + 1),
TextInput::make('title')
->label(__('products.step_title'))
->required()
->columnSpanFull(),
Textarea::make('description')
->label(__('products.step_description'))
@@ -165,10 +161,8 @@ class LandingPageSection
->columnSpanFull(),
])
->columns(1)
->defaultItems(4)
->minItems(4)
->maxItems(4)
->reorderable(false)
->defaultItems(0)
->reorderable()
->collapsible()
->itemLabel(fn (array $state): ?string => __('products.step') . ' ' . ($state['number'] ?? '') . ': ' . ($state['title'] ?? ''))
->columnSpanFull(),
@@ -199,12 +193,10 @@ class LandingPageSection
->schema([
TextInput::make('question')
->label(__('products.faq_question'))
->required()
->columnSpanFull(),
Textarea::make('answer')
->label(__('products.faq_answer'))
->rows(3)
->required()
->columnSpanFull(),
])
->columns(1)
@@ -54,6 +54,7 @@ class ProductForm
->searchable(),
FileUpload::make('hero_image')
->label(__('products.hero_image'))
->required()
->image()
->disk('public')
->directory('products'),