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:
@@ -15,6 +15,10 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
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 @@ class HomePageSettings extends SettingsPage
|
||||
|
||||
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 @@ use Filament\Forms\Components\FileUpload;
|
||||
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 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
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 @@ class ManagePortfolio extends SettingsPage
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
return __('Home');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
|
||||
@@ -10,6 +10,8 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
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 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
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 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
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 @@ class ManageSolutions extends SettingsPage
|
||||
|
||||
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 @@ use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
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 @@ class ManageSuccess extends SettingsPage
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
85
app/Filament/Resources/SolutionResource.php
Normal file
85
app/Filament/Resources/SolutionResource.php
Normal file
@@ -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 @@ class AppServiceProvider extends ServiceProvider
|
||||
Model::unguard();
|
||||
|
||||
$this->addSettingsToViews();
|
||||
$this->addSolutionsToViews();
|
||||
|
||||
// logDB();
|
||||
}
|
||||
@@ -41,4 +43,14 @@ class AppServiceProvider extends ServiceProvider
|
||||
$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());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('solutions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->text('description');
|
||||
$table->string('slug')->unique();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,12 +20,9 @@
|
||||
|
||||
<li class="menu-item-has-children"><a href="{{ route('our-solutions.index') }}">{{ __('Our solutions') }}</a>
|
||||
<ul class="sub-menu">
|
||||
<li><a href="history.html">Company History</a></li>
|
||||
<li><a href="testimonial.html">Testimonials</a></li>
|
||||
<li><a href="pricing.html">Price Plans</a></li>
|
||||
<li><a href="faq.html">FAQ's</a></li>
|
||||
<li><a href="request-quote.html">Request Quote</a></li>
|
||||
<li><a href="404-error.html">404 Page</a></li>
|
||||
@foreach($solutions as $solution)
|
||||
<li><a href="{{ route('our-solutions.show', $solution->slug) }}">{{ $solution->name }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user