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:
nurmuhammet committed 2025-09-03 19:10:21 +05:00
1 parent f9f4c476ce
commit e2b47eb73f
39 files changed
+634 -53

No files matched your search

@@ -5,6 +5,7 @@
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 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 @@ public static function form(Schema $schema): Schema
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 @@ public static function getPages(): array
return [
'index' => ListHotels::route('/'),
'create' => CreateHotel::route('/create'),
'view' => ViewHotel::route('/{record}'),
'edit' => EditHotel::route('/{record}/edit'),
];
}
@@ -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(),
];
}
}
@@ -11,7 +11,7 @@ public static function schema(): array
return [
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\Select::make('city')
->options([
'Makkah' => 'Makkah',
@@ -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'),
]);
}
}
@@ -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 @@ public static function schema(): array
->toggleable(isToggledHiddenByDefault: true),
];
}
public static function actions(): array
{
return [
ViewAction::make(),
EditAction::make(),
];
}
}