From 6d564bb285426189bfbc6bb885a9e1a51bcbd46a Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Mon, 28 Jul 2025 15:18:32 +0500 Subject: [PATCH] Enhance homepage with dynamic success and portfolio settings: replace static content with values from SuccessSettings and PortfolioSettings, and implement loops for skill and portfolio items. --- app/Filament/Pages/ManagePortfolio.php | 106 ++++++++++++++++++ app/Filament/Pages/ManageSuccess.php | 104 +++++++++++++++++ app/Settings/PortfolioSettings.php | 21 ++++ app/Settings/SuccessSettings.php | 25 +++++ ...5_07_28_151014_create_success_settings.php | 19 ++++ ...07_28_151409_create_portfolio_settings.php | 19 ++++ .../views/web/pages/home/index.blade.php | 84 +++++--------- 7 files changed, 321 insertions(+), 57 deletions(-) create mode 100644 app/Filament/Pages/ManagePortfolio.php create mode 100644 app/Filament/Pages/ManageSuccess.php create mode 100644 app/Settings/PortfolioSettings.php create mode 100644 app/Settings/SuccessSettings.php create mode 100644 database/settings/2025_07_28_151014_create_success_settings.php create mode 100644 database/settings/2025_07_28_151409_create_portfolio_settings.php diff --git a/app/Filament/Pages/ManagePortfolio.php b/app/Filament/Pages/ManagePortfolio.php new file mode 100644 index 0000000..fb08872 --- /dev/null +++ b/app/Filament/Pages/ManagePortfolio.php @@ -0,0 +1,106 @@ +schema([ + Section::make('Portfolio Section Content') + ->description('Manage the main content for the portfolio section.') + ->icon('heroicon-o-document-text') + ->schema([ + TextInput::make('portfolio_header') + ->label('Header') + ->required() + ->maxLength(255), + Grid::make()->schema([ + TextInput::make('portfolio_button_text') + ->label('Button Text') + ->maxLength(50), + TextInput::make('portfolio_button_url') + ->label('Button URL') + ->maxLength(255) + ->url(), + ])->columns(2), + ]), + Section::make('Portfolio Items') + ->description('Manage individual portfolio items.') + ->icon('heroicon-o-photo') + ->schema([ + Repeater::make('portfolio_items') + ->label('Portfolio Items') + ->schema([ + FileUpload::make('image') + ->label('Image (700x525)') + ->image() ->maxSize(2048) + ->disk('public') + ->directory('portfolio-images') + ->required(), + TextInput::make('category') + ->label('Category') + ->required() + ->maxLength(100), + TextInput::make('title') + ->label('Title') + ->required() + ->maxLength(255), + TextInput::make('link') + ->label('Link') + ->required() + ->maxLength(255) + ->url(), + ]) + ->columns(2) + ->minItems(1) + ->maxItems(8) + ->defaultItems(4) + ->reorderable() + ->collapsible(), + ]), + ]) + ->columns(1) + ->statePath('data'); + } + + public static function getNavigationGroup(): ?string + { + return __('CMS'); + } + + public static function getNavigationLabel(): string + { + return __('Portfolio'); + } + + public function getTitle(): string|Htmlable + { + return 'Portfolio'; + } + + public function getHeading(): string|Htmlable + { + return 'Edit portfolio section content from here'; + } + + public function getSubheading(): string|Htmlable|null + { + return 'Manage the portfolio section content, including items, categories, and titles.'; + } +} \ No newline at end of file diff --git a/app/Filament/Pages/ManageSuccess.php b/app/Filament/Pages/ManageSuccess.php new file mode 100644 index 0000000..329c1d9 --- /dev/null +++ b/app/Filament/Pages/ManageSuccess.php @@ -0,0 +1,104 @@ +schema([ + Section::make('Success Section Content') + ->description('Manage the main content for the success section.') + ->icon('heroicon-o-document-text') + ->schema([ + TextInput::make('success_subtitle') + ->label('Subtitle') + ->maxLength(100), + TextInput::make('success_header') + ->label('Header') + ->required() + ->maxLength(255), + Textarea::make('success_paragraph') + ->label('Paragraph') + ->rows(3) + ->maxLength(65535), + Grid::make()->schema([ + TextInput::make('success_button_text') + ->label('Button Text') + ->maxLength(50), + TextInput::make('success_button_url') + ->label('Button URL') + ->maxLength(255) + ->url(), + ])->columns(2), + ]), + Section::make('Skill Items') + ->description('Manage the skill items with their names and percentages.') + ->icon('heroicon-o-adjustments-vertical') + ->schema([ + Repeater::make('skill_items') + ->label('Skill Items') + ->schema([ + TextInput::make('name') + ->label('Skill Name') + ->required() + ->maxLength(100), + TextInput::make('percentage') + ->label('Percentage') + ->numeric() + ->required() + ->minValue(0) + ->maxValue(100), + ]) + ->columns(2) + ->minItems(1) + ->maxItems(5) + ->defaultItems(2) + ->reorderable() + ->collapsible(), + ]), + ]) + ->columns(1) + ->statePath('data'); + } + + public static function getNavigationGroup(): ?string + { + return __('CMS'); + } + + public static function getNavigationLabel(): string + { + return __('Success Section'); + } + + public function getTitle(): string|Htmlable + { + return 'Success Section'; + } + + public function getHeading(): string|Htmlable + { + return 'Edit success section content from here'; + } + + public function getSubheading(): string|Htmlable|null + { + return 'Manage the success section content, including text, button, and skill bars.'; + } +} \ No newline at end of file diff --git a/app/Settings/PortfolioSettings.php b/app/Settings/PortfolioSettings.php new file mode 100644 index 0000000..f94f224 --- /dev/null +++ b/app/Settings/PortfolioSettings.php @@ -0,0 +1,21 @@ +migrator->add('cms_success.success_subtitle', 'Construction Advices'); + $this->migrator->add('cms_success.success_header', 'Building Success With Expert Advisory Services'); + $this->migrator->add('cms_success.success_paragraph', 'With a focus on innovation and sustainability, we help you navigate complex challenges, ensuring'); + $this->migrator->add('cms_success.success_button_text', 'Get Advices'); + $this->migrator->add('cms_success.success_button_url', 'contact.html'); + $this->migrator->add('cms_success.skill_items', [ + ['name' => 'Building Construction', 'percentage' => 89], + ['name' => 'Interiors Design', 'percentage' => 70], + ]); + } +}; diff --git a/database/settings/2025_07_28_151409_create_portfolio_settings.php b/database/settings/2025_07_28_151409_create_portfolio_settings.php new file mode 100644 index 0000000..e26050c --- /dev/null +++ b/database/settings/2025_07_28_151409_create_portfolio_settings.php @@ -0,0 +1,19 @@ +migrator->add('cms_portfolio.portfolio_header', 'Get Expert Construction Advice and a Free Quote'); + $this->migrator->add('cms_portfolio.portfolio_button_text', 'Start a Journey'); + $this->migrator->add('cms_portfolio.portfolio_button_url', 'request-quote.html'); + $this->migrator->add('cms_portfolio.portfolio_items', [ + ['image' => 'portfolio/portfolio-6.jpg', 'category' => 'Hospitality', 'title' => 'Seaside Resort Expansion', 'link' => '#'], + ['image' => 'portfolio/portfolio-2.jpg', 'category' => 'Retail', 'title' => 'Urban Mall Development', 'link' => '#'], + ['image' => 'portfolio/portfolio-4.jpg', 'category' => 'Residential', 'title' => 'Luxury Home Renovation', 'link' => '#'], + ['image' => 'portfolio/portfolio-8.jpg', 'category' => 'Architecture', 'title' => 'Modern Architecture', 'link' => '#'], + ]); + } +}; diff --git a/resources/views/web/pages/home/index.blade.php b/resources/views/web/pages/home/index.blade.php index 49601c4..416dbe0 100644 --- a/resources/views/web/pages/home/index.blade.php +++ b/resources/views/web/pages/home/index.blade.php @@ -1,6 +1,8 @@ @extends('web.layouts.app') @inject('solutionSettings', 'App\Settings\SolutionSettings') +@inject('successSettings', 'App\Settings\SuccessSettings') +@inject('portfolioSettings', 'App\Settings\PortfolioSettings') @section('content') @@ -167,11 +169,11 @@
- Construction Advices -

Building Success With Expert Advisory Services

-

With a focus on innovation and sustainability, we help you navigate complex challenges, ensuring

+ {{ $successSettings->success_subtitle }} +

{{ $successSettings->success_header }}

+

{{ $successSettings->success_paragraph }}

@@ -179,24 +181,17 @@
image
-
-
-
Building Construction
- 89% + @foreach($successSettings->skill_items as $skill) +
+
+
{{ $skill['name'] }}
+ {{ $skill['percentage'] }}% +
+
+
+
-
-
-
-
-
-
-
Interiors Design
- 70% -
-
-
-
-
+ @endforeach
@@ -210,42 +205,17 @@
-
- image -
-
- Hospitality -

Seaside Resort Expansion

+ @foreach($portfolioSettings->portfolio_items as $item) +
+ image +
+
+ {{ $item['category'] }} +

{{ $item['title'] }}

+
-
-
- image -
-
- Retail -

Urban Mall Development

-
-
-
-
- image -
-
- Residential -

Luxury Home Renovation

-
-
-
-
- image -
-
- Architecture -

Modern Architecture

-
-
-
+ @endforeach
@@ -253,11 +223,11 @@
-

Get Expert Construction Advice and a Free Quote

+

{{ $portfolioSettings->portfolio_header }}