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:
@@ -107,11 +107,9 @@ class LandingPageSection
|
|||||||
Select::make('icon')
|
Select::make('icon')
|
||||||
->label(__('products.feature_icon'))
|
->label(__('products.feature_icon'))
|
||||||
->options($iconOptions)
|
->options($iconOptions)
|
||||||
->searchable()
|
->searchable(),
|
||||||
->required(),
|
|
||||||
TextInput::make('title')
|
TextInput::make('title')
|
||||||
->label(__('products.feature_title'))
|
->label(__('products.feature_title'))
|
||||||
->required()
|
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
Textarea::make('description')
|
Textarea::make('description')
|
||||||
->label(__('products.feature_description'))
|
->label(__('products.feature_description'))
|
||||||
@@ -153,11 +151,9 @@ class LandingPageSection
|
|||||||
TextInput::make('number')
|
TextInput::make('number')
|
||||||
->label(__('products.step_number'))
|
->label(__('products.step_number'))
|
||||||
->numeric()
|
->numeric()
|
||||||
->default(fn ($get) => ($get('../../../_index') ?? 0) + 1)
|
->default(fn ($get) => ($get('../../../_index') ?? 0) + 1),
|
||||||
->required(),
|
|
||||||
TextInput::make('title')
|
TextInput::make('title')
|
||||||
->label(__('products.step_title'))
|
->label(__('products.step_title'))
|
||||||
->required()
|
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
Textarea::make('description')
|
Textarea::make('description')
|
||||||
->label(__('products.step_description'))
|
->label(__('products.step_description'))
|
||||||
@@ -165,10 +161,8 @@ class LandingPageSection
|
|||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
])
|
])
|
||||||
->columns(1)
|
->columns(1)
|
||||||
->defaultItems(4)
|
->defaultItems(0)
|
||||||
->minItems(4)
|
->reorderable()
|
||||||
->maxItems(4)
|
|
||||||
->reorderable(false)
|
|
||||||
->collapsible()
|
->collapsible()
|
||||||
->itemLabel(fn (array $state): ?string => __('products.step') . ' ' . ($state['number'] ?? '') . ': ' . ($state['title'] ?? ''))
|
->itemLabel(fn (array $state): ?string => __('products.step') . ' ' . ($state['number'] ?? '') . ': ' . ($state['title'] ?? ''))
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
@@ -199,12 +193,10 @@ class LandingPageSection
|
|||||||
->schema([
|
->schema([
|
||||||
TextInput::make('question')
|
TextInput::make('question')
|
||||||
->label(__('products.faq_question'))
|
->label(__('products.faq_question'))
|
||||||
->required()
|
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
Textarea::make('answer')
|
Textarea::make('answer')
|
||||||
->label(__('products.faq_answer'))
|
->label(__('products.faq_answer'))
|
||||||
->rows(3)
|
->rows(3)
|
||||||
->required()
|
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
])
|
])
|
||||||
->columns(1)
|
->columns(1)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class ProductForm
|
|||||||
->searchable(),
|
->searchable(),
|
||||||
FileUpload::make('hero_image')
|
FileUpload::make('hero_image')
|
||||||
->label(__('products.hero_image'))
|
->label(__('products.hero_image'))
|
||||||
|
->required()
|
||||||
->image()
|
->image()
|
||||||
->disk('public')
|
->disk('public')
|
||||||
->directory('products'),
|
->directory('products'),
|
||||||
|
|||||||
Reference in New Issue
Block a user