Hotel Management and Booking Rooms

Filament 3

This project demonstrates multiple panels in one Filament application: one for hotel management, and another for search and book hotel rooms.

Untitled design (16)

Get the Source Code:

Only This Example

$9

One-time payment

Full source code for Hotel Management and Booking Rooms
Downloadable ZIP file with the source code
Lifetime access to this example
GitHub Sign in with GitHub to buy

Sign in first, then complete your $9 checkout.

Best value — all 175 examples

FilamentExamples Membership

$99 /year
or
$199 lifetime
Access to code of all 175 examples
Future new examples and updates included
FilaCheck Pro package licence included
MCP server included
View membership plans

30-day money-back guarantee

How it works

In this Filament Example project, we have two panels:

  • Hotel, for managing hotel with rooms.
  • Booking, for making a room booking.

When a user registers to any panel, they are automatically assigned a role based on the panel. It is done in Eloquent Events closures method in the User Model.

protected static function booted(): void
{
static::created(function (User $user) {
if (filament()->getCurrentPanel()->getId() === 'hotel') {
$user->assignRole('hotels');
}
if (filament()->getCurrentPanel()->getId() === 'booking') {
$user->assignRole('customers');
}
});
}

According to the role, the user gets access to a panel.

public function canAccessPanel(Panel $panel): bool
{
if ($panel->getId() === 'hotel' && $this->hasRole('hotels')) {
return true;
}
 
if ($panel->getId() === 'booking' && $this->hasRole('customers')) {
return true;
}
 
return false;
}

Hotel Panel

In the hotel panel, we have a custom page, MyHotel, where users can manage information about their hotel. It is a HasOne relation to the Hotel Model.

public function hotel(): HasOne
{
return $this->hasOne(Hotel::class);
}

The form is filled in the Livewire components mount() method. For the form, we use Filament Forms.

app/Filament/Hotel/Pages/MyHotel.php:

use Filament\Pages\Page;
use Filament\Forms\Form;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Concerns\InteractsWithForms;
 
class MyHotel extends Page implements HasForms
{
use InteractsWithForms;
 
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.hotel.pages.my-hotel';
public ?array $data = [];
 
public function mount(): void
{
$this->form->fill(auth()->user()->hotel?->attributesToArray());
}
 
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')
->required(),
TextInput::make('address')
->required(),
Textarea::make('description')
->required(),
FileUpload::make('photo')
->image()
->required(),
Checkbox::make('is_published'),
])
->statePath('data');
}
}

To add actions to the form, we use...

The FULL tutorial is available after the purchase: in the Readme file of the official repository you would get invited to.