Refactor navigation settings across multiple pages: update navigation groups and labels for HomePageSettings, ManageCtaSettings, ManagePortfolio, ManageSolutions, ManageSuccess, and ManageSite. Introduce solutions data fetching in OurSolutionPageController and enhance header navigation with dynamic solutions list. Update database migration to include new fields for solutions.
This commit is contained in:
1 parent
74fc3b5e6a
commit
7fdb99cc79
16 files changed
+182
-16
No files matched your search
@@ -15,6 +15,10 @@
|
||||
|
||||
class HomePageSettings extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'Home';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-home';
|
||||
|
||||
protected static string $settings = HomeSettings::class;
|
||||
|
||||
public function form(Form $form): Form
|
||||
@@ -267,12 +271,12 @@ public function form(Form $form): Form
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
return __('Home');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Home');
|
||||
return __('Home Page Settings');
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
|
||||
@@ -11,11 +11,16 @@
|
||||
class ManageCtaSettings extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'CMS';
|
||||
protected static ?string $navigationLabel = 'Call To Action';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-megaphone';
|
||||
|
||||
protected static string $settings = CtaSettings::class;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Call To Action';
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
class ManagePortfolio extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'Home';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-briefcase';
|
||||
|
||||
protected static string $settings = PortfolioSettings::class;
|
||||
@@ -84,7 +86,7 @@ public function form(Form $form): Form
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
return __('Home');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
class ManageSite extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'Settings';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-globe-alt';
|
||||
|
||||
protected static string $settings = SiteSettings::class;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class ManageSiteSocialSettings extends SettingsPage
|
||||
{
|
||||
protected static ?int $navigationSort = 4;
|
||||
protected static ?string $navigationGroup = 'Settings';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-share';
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
class ManageSolutions extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'Home';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-wrench-screwdriver';
|
||||
|
||||
protected static string $settings = SolutionSettings::class;
|
||||
@@ -352,12 +354,12 @@ private static function getIconOptions(): array
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
return __('Home');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Solutions');
|
||||
return __('Manage Solutions');
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
class ManageSuccess extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationGroup = 'Home';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-check-circle';
|
||||
|
||||
protected static string $settings = SuccessSettings::class;
|
||||
@@ -89,7 +91,7 @@ public function form(Form $form): Form
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
return __('Home');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
|
||||
@@ -19,7 +19,7 @@ class BrandResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Brand::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static ?string $navigationIcon = 'heroicon-o-tag';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\SolutionResource\Pages;
|
||||
use App\Filament\Resources\SolutionResource\RelationManagers;
|
||||
use App\Models\Solution;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class SolutionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Solution::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Solutions';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('title')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\TextInput::make('slug')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Forms\Components\RichEditor::make('description')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('title')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('slug')
|
||||
->searchable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSolutions::route('/'),
|
||||
'create' => Pages\CreateSolution::route('/create'),
|
||||
'edit' => Pages\EditSolution::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SolutionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SolutionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSolution extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SolutionResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SolutionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SolutionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSolution extends EditRecord
|
||||
{
|
||||
protected static string $resource = SolutionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SolutionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\SolutionResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSolutions extends ListRecords
|
||||
{
|
||||
protected static string $resource = SolutionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,9 @@ class OurSolutionPageController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('web.pages.our-solutions.index');
|
||||
$solutions = Solution::all();
|
||||
|
||||
return view('web.pages.our-solutions.index', compact('solutions'));
|
||||
}
|
||||
|
||||
public function show(Solution $solution)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Models\Solution;
|
||||
use App\Settings\SiteSettings;
|
||||
use App\Settings\SiteSocialSettings;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -27,6 +28,7 @@ public function boot(): void
|
||||
Model::unguard();
|
||||
|
||||
$this->addSettingsToViews();
|
||||
$this->addSolutionsToViews();
|
||||
|
||||
// logDB();
|
||||
}
|
||||
@@ -41,4 +43,14 @@ public function addSettingsToViews(): void
|
||||
$view->with('socialMedia', app(SiteSocialSettings::class));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add solutions to views
|
||||
*/
|
||||
public function addSolutionsToViews(): void
|
||||
{
|
||||
ViewFacade::composer(['web.layouts.navigation.header'], function (View $view) {
|
||||
$view->with('solutions', Solution::query()->latest()->get());
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user