[NEW] Filament Adminpanel for API Project

In the first lesson of this course, we will install Filament and will allow only users with the role of administrator to access the admin panel.

filament admin panel

DB Schema and Models for Resources

So, our plan in this course is to take the existing database with its models, and create adminpanel for them, as Filament Resources, one by one.

So you would have the full pictire, this is the full DB schema of the project.

db schema

And here's the list of Models we will create Resources for, in groups step-by-step:

  • User
  • Country / City / Geoobject
  • Apartment Type / Bed Type / Room Type
  • Facility / Facility Category
  • Property / Apartment / Room / Bed
  • Booking

So, let's go do this!

Installing Filament

For this first short lesson, we will just install Filament. It's extremely easy.

composer require filament/filament

Next, we need to implement FilamentUser in the User model and add the canAccessFilament method.


use Filament\Models\Contracts\FilamentUser;
class User extends Authenticatable implements FilamentUser
// ...
public function canAccessFilament(): bool
return $this->role_id === Role::ROLE_ADMINISTRATOR;

And that's it! We have prepared Filament. You can now log in with the administrator user, by visiting the /admin URL.

From the initial API course, we have such users with users.role_id=1

After logging in, the administrator would see this empty dashboard, with no features, for now.

filament admin panel

No comments or questions yet...