Refactor GroupResource to use a static property for navigation icon; add method documentation for name attribute in Group model.
This commit is contained in:
58
app/Filament/Resources/Hotels/HotelResource.php
Normal file
58
app/Filament/Resources/Hotels/HotelResource.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
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\RelationManagers\RoomsRelationManager;
|
||||
use App\Filament\Resources\Hotels\Schemas\HotelForm;
|
||||
use App\Filament\Resources\Hotels\Tables\HotelsTable;
|
||||
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
|
||||
{
|
||||
protected static ?string $model = Hotel::class;
|
||||
|
||||
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';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema->schema(HotelForm::schema());
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table->columns(HotelsTable::schema());
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RoomsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListHotels::route('/'),
|
||||
'create' => CreateHotel::route('/create'),
|
||||
'edit' => EditHotel::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user