Refactor navigation icon declarations in various resources for consistency; enhance Group model with new relationships and fillable properties; update Hotel and Pilgrim models with fillable attributes; improve table configurations across resources.

This commit is contained in:
2025-09-03 19:10:21 +05:00
parent f9f4c476ce
commit e2b47eb73f
39 changed files with 634 additions and 53 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Filament\Resources\Hotels;
use App\Filament\Resources\Hotels\Pages\CreateHotel;
use App\Filament\Resources\Hotels\Pages\EditHotel;
use App\Filament\Resources\Hotels\Pages\ListHotels;
use App\Filament\Resources\Hotels\Pages\ViewHotel;
use App\Filament\Resources\Hotels\RelationManagers\RoomsRelationManager;
use App\Filament\Resources\Hotels\Schemas\HotelForm;
use App\Filament\Resources\Hotels\Tables\HotelsTable;
@@ -12,7 +13,6 @@ use App\Models\Hotel;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
class HotelResource extends Resource
@@ -22,13 +22,14 @@ class HotelResource extends Resource
protected static ?string $navigationLabel = 'Otellar';
protected static ?string $pluralLabel = 'Otellar';
protected static ?string $modelLabel = 'Otel';
protected static ?string $recordTitleAttribute = 'name';
protected static ?int $navigationSort = 5;
protected static string | BackedEnum | null $navigationIcon = 'heroicon-o-building-office';
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-building-office';
public static function form(Schema $schema): Schema
{
@@ -37,7 +38,9 @@ class HotelResource extends Resource
public static function table(Table $table): Table
{
return $table->columns(HotelsTable::schema());
return $table
->columns(HotelsTable::schema())
->actions(HotelsTable::actions());
}
public static function getRelations(): array
@@ -52,6 +55,7 @@ class HotelResource extends Resource
return [
'index' => ListHotels::route('/'),
'create' => CreateHotel::route('/create'),
'view' => ViewHotel::route('/{record}'),
'edit' => EditHotel::route('/{record}/edit'),
];
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Filament\Resources\Hotels\Pages;
use App\Filament\Resources\Hotels\HotelResource;
use App\Filament\Resources\Hotels\Schemas\HotelInfolist;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
use Filament\Schemas\Schema;
class ViewHotel extends ViewRecord
{
protected static string $resource = HotelResource::class;
public function infolist(Schema $schema): Schema
{
return HotelInfolist::configure($schema);
}
protected function getHeaderActions(): array
{
return [
Actions\EditAction::make(),
];
}
}

View File

@@ -11,7 +11,7 @@ class HotelForm
return [
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\Select::make('city')
->options([
'Makkah' => 'Makkah',

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Filament\Resources\Hotels\Schemas;
use Filament\Infolists;
use Filament\Schemas\Schema;
class HotelInfolist
{
public static function configure(Schema $schema): Schema
{
return $schema->components([
Infolists\Components\TextEntry::make('name'),
Infolists\Components\TextEntry::make('city'),
Infolists\Components\ImageEntry::make('image')
->columnSpanFull(),
Infolists\Components\ImageEntry::make('images')
->columnSpanFull(),
Infolists\Components\TextEntry::make('geo_location'),
Infolists\Components\TextEntry::make('haram_distance'),
Infolists\Components\TextEntry::make('star'),
]);
}
}

View File

@@ -2,6 +2,8 @@
namespace App\Filament\Resources\Hotels\Tables;
use Filament\Actions\EditAction;
use Filament\Actions\ViewAction;
use Filament\Tables;
class HotelsTable
@@ -35,4 +37,12 @@ class HotelsTable
->toggleable(isToggledHiddenByDefault: true),
];
}
public static function actions(): array
{
return [
ViewAction::make(),
EditAction::make(),
];
}
}