Refactor GroupResource to use a static property for navigation icon; add method documentation for name attribute in Group model.
This commit is contained in:
@@ -13,7 +13,6 @@ use BackedEnum;
|
|||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Contracts\Support\Htmlable;
|
|
||||||
|
|
||||||
class GroupResource extends Resource
|
class GroupResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -27,10 +26,7 @@ class GroupResource extends Resource
|
|||||||
|
|
||||||
protected static ?int $navigationSort = 1;
|
protected static ?int $navigationSort = 1;
|
||||||
|
|
||||||
public static function getNavigationIcon(): string | BackedEnum | Htmlable | null
|
protected static string | BackedEnum | null $navigationIcon = 'icon-flight-takeoff';
|
||||||
{
|
|
||||||
return 'icon-flight-takeoff';
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function form(Schema $schema): Schema
|
public static function form(Schema $schema): Schema
|
||||||
{
|
{
|
||||||
|
|||||||
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'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Filament/Resources/Hotels/Pages/CreateHotel.php
Normal file
11
app/Filament/Resources/Hotels/Pages/CreateHotel.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Hotels\HotelResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateHotel extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = HotelResource::class;
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Hotels/Pages/EditHotel.php
Normal file
19
app/Filament/Resources/Hotels/Pages/EditHotel.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Hotels\HotelResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditHotel extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = HotelResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Hotels/Pages/ListHotels.php
Normal file
19
app/Filament/Resources/Hotels/Pages/ListHotels.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Hotels\HotelResource;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListHotels extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = HotelResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\RelationManagers;
|
||||||
|
|
||||||
|
use Filament\Actions\AssociateAction;
|
||||||
|
use Filament\Actions\BulkActionGroup;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Actions\DeleteBulkAction;
|
||||||
|
use Filament\Actions\DissociateAction;
|
||||||
|
use Filament\Actions\DissociateBulkAction;
|
||||||
|
use Filament\Actions\EditAction;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Resources\RelationManagers\RelationManager;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class RoomsRelationManager extends RelationManager
|
||||||
|
{
|
||||||
|
protected static string $relationship = 'rooms';
|
||||||
|
|
||||||
|
public function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
TextInput::make('name')
|
||||||
|
->required()
|
||||||
|
->maxLength(255),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->recordTitleAttribute('name')
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('name')
|
||||||
|
->searchable(),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
//
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
CreateAction::make(),
|
||||||
|
AssociateAction::make(),
|
||||||
|
])
|
||||||
|
->recordActions([
|
||||||
|
EditAction::make(),
|
||||||
|
DissociateAction::make(),
|
||||||
|
DeleteAction::make(),
|
||||||
|
])
|
||||||
|
->toolbarActions([
|
||||||
|
BulkActionGroup::make([
|
||||||
|
DissociateBulkAction::make(),
|
||||||
|
DeleteBulkAction::make(),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
38
app/Filament/Resources/Hotels/Schemas/HotelForm.php
Normal file
38
app/Filament/Resources/Hotels/Schemas/HotelForm.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Schemas;
|
||||||
|
|
||||||
|
use Filament\Forms;
|
||||||
|
|
||||||
|
class HotelForm
|
||||||
|
{
|
||||||
|
public static function schema(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Forms\Components\TextInput::make('name')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\Select::make('city')
|
||||||
|
->options([
|
||||||
|
'Makkah' => 'Makkah',
|
||||||
|
'Madinah' => 'Madinah',
|
||||||
|
])
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\FileUpload::make('image')
|
||||||
|
->image(),
|
||||||
|
Forms\Components\FileUpload::make('images')
|
||||||
|
->multiple(),
|
||||||
|
Forms\Components\TextInput::make('geo_location'),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('haram_distance')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('star')
|
||||||
|
->required()
|
||||||
|
->numeric()
|
||||||
|
->minValue(1)
|
||||||
|
->maxValue(5),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
38
app/Filament/Resources/Hotels/Tables/HotelsTable.php
Normal file
38
app/Filament/Resources/Hotels/Tables/HotelsTable.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Hotels\Tables;
|
||||||
|
|
||||||
|
use Filament\Tables;
|
||||||
|
|
||||||
|
class HotelsTable
|
||||||
|
{
|
||||||
|
public static function schema(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Tables\Columns\ImageColumn::make('image')
|
||||||
|
->circular()
|
||||||
|
->imageSize(60),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('name')
|
||||||
|
->searchable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('city')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('haram_distance'),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('star')
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/Filament/Resources/Rooms/Pages/CreateRoom.php
Normal file
11
app/Filament/Resources/Rooms/Pages/CreateRoom.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Rooms\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Rooms\RoomResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateRoom extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = RoomResource::class;
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Rooms/Pages/EditRoom.php
Normal file
19
app/Filament/Resources/Rooms/Pages/EditRoom.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Rooms\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Rooms\RoomResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditRoom extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = RoomResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
19
app/Filament/Resources/Rooms/Pages/ListRooms.php
Normal file
19
app/Filament/Resources/Rooms/Pages/ListRooms.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Rooms\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Rooms\RoomResource;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListRooms extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = RoomResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
57
app/Filament/Resources/Rooms/RoomResource.php
Normal file
57
app/Filament/Resources/Rooms/RoomResource.php
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Rooms;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Rooms\Pages\CreateRoom;
|
||||||
|
use App\Filament\Resources\Rooms\Pages\EditRoom;
|
||||||
|
use App\Filament\Resources\Rooms\Pages\ListRooms;
|
||||||
|
use App\Filament\Resources\Rooms\Schemas\RoomForm;
|
||||||
|
use App\Filament\Resources\Rooms\Tables\RoomsTable;
|
||||||
|
use App\Models\Room;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Support\Icons\Heroicon;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class RoomResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Room::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Otaglar';
|
||||||
|
|
||||||
|
protected static ?string $pluralLabel = 'Otaglar';
|
||||||
|
protected static ?string $modelLabel = 'Otag';
|
||||||
|
|
||||||
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
protected static ?int $navigationSort = 6;
|
||||||
|
protected static string | BackedEnum | null $navigationIcon = 'icon-door-open';
|
||||||
|
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return RoomForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table->columns(RoomsTable::schema());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => ListRooms::route('/'),
|
||||||
|
'create' => CreateRoom::route('/create'),
|
||||||
|
'edit' => EditRoom::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
36
app/Filament/Resources/Rooms/Schemas/RoomForm.php
Normal file
36
app/Filament/Resources/Rooms/Schemas/RoomForm.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Rooms\Schemas;
|
||||||
|
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class RoomForm
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema->components([
|
||||||
|
Forms\Components\Select::make('hotel_id')
|
||||||
|
->relationship('hotel', 'name')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('name')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('floor')
|
||||||
|
->required(),
|
||||||
|
|
||||||
|
Forms\Components\FileUpload::make('images')
|
||||||
|
->multiple(),
|
||||||
|
|
||||||
|
Forms\Components\TextInput::make('bed_count')
|
||||||
|
->required()
|
||||||
|
->numeric()
|
||||||
|
->default(1),
|
||||||
|
|
||||||
|
Forms\Components\Checkbox::make('wide')
|
||||||
|
->default(false)
|
||||||
|
->required(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Filament/Resources/Rooms/Tables/RoomsTable.php
Normal file
33
app/Filament/Resources/Rooms/Tables/RoomsTable.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Rooms\Tables;
|
||||||
|
|
||||||
|
use Filament\Tables;
|
||||||
|
|
||||||
|
class RoomsTable
|
||||||
|
{
|
||||||
|
public static function schema(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Tables\Columns\TextColumn::make('hotel.name')
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('name')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('floor')
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('bed_count')
|
||||||
|
->numeric()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\IconColumn::make('wide')
|
||||||
|
->boolean(),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,11 @@ class Group extends Model
|
|||||||
'end_date' => 'date',
|
'end_date' => 'date',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the group
|
||||||
|
*
|
||||||
|
* @return Attribute
|
||||||
|
* */
|
||||||
public function name(): Attribute
|
public function name(): Attribute
|
||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
|
|||||||
27
app/Models/Hotel.php
Normal file
27
app/Models/Hotel.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
|
||||||
|
class Hotel extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'images' => 'array',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rooms(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Room::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/Models/Room.php
Normal file
28
app/Models/Room.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
|
||||||
|
class Room extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
protected function casts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'images' => 'array',
|
||||||
|
'wide' => 'boolean',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hotel(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Hotel::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('hotels', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('image')->nullable();
|
||||||
|
$table->json('images')->nullable();
|
||||||
|
$table->json('geo_location')->nullable();
|
||||||
|
$table->enum('city', ['Makkah', 'Madinah']);
|
||||||
|
$table->string('haram_distance');
|
||||||
|
$table->unsignedTinyInteger('star')->default(1);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('hotels');
|
||||||
|
}
|
||||||
|
};
|
||||||
33
database/migrations/2025_08_31_160212_create_rooms_table.php
Normal file
33
database/migrations/2025_08_31_160212_create_rooms_table.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('rooms', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->foreignId('hotel_id')->constrained()->cascadeOnDelete();
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('floor');
|
||||||
|
$table->json('images')->nullable();
|
||||||
|
$table->unsignedTinyInteger('bed_count')->default(1);
|
||||||
|
$table->boolean('wide')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('rooms');
|
||||||
|
}
|
||||||
|
};
|
||||||
1
resources/svg/door-open.svg
Normal file
1
resources/svg/door-open.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="currentColor"><path d="M440-440q17 0 28.5-11.5T480-480q0-17-11.5-28.5T440-520q-17 0-28.5 11.5T400-480q0 17 11.5 28.5T440-440ZM280-120v-80l240-40v-445q0-15-9-27t-23-14l-208-34v-80l220 36q44 8 72 41t28 77v512l-320 54Zm-160 0v-80h80v-560q0-34 23.5-57t56.5-23h400q34 0 57 23t23 57v560h80v80H120Zm160-80h400v-560H280v560Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 423 B |
Reference in New Issue
Block a user