From 3a2661cf959ae3c715dba099a356d3bffb27b77b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Tue, 6 Jan 2026 21:36:13 +0300 Subject: [PATCH] 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. --- .../Products/Schemas/LandingPageSection.php | 16 ++++------------ .../Resources/Products/Schemas/ProductForm.php | 1 + 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php b/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php index e8c587d..167c60f 100644 --- a/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php +++ b/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php @@ -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) diff --git a/app/Filament/Admin/Resources/Products/Schemas/ProductForm.php b/app/Filament/Admin/Resources/Products/Schemas/ProductForm.php index 219158c..09a1d80 100644 --- a/app/Filament/Admin/Resources/Products/Schemas/ProductForm.php +++ b/app/Filament/Admin/Resources/Products/Schemas/ProductForm.php @@ -54,6 +54,7 @@ class ProductForm ->searchable(), FileUpload::make('hero_image') ->label(__('products.hero_image')) + ->required() ->image() ->disk('public') ->directory('products'),