Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anjanesh's avatar

Admin for models

I need to create a catalog of sort for a physical product based company and I had done one such test in Django where the backend is the Django admin which the user can login to upload. The backend job was minimal since all I had to do was to define the Admin's models in admin.py.

Whats the Laravel equivalent ? FilamentPHP CMS ? It seems I need to create a number of files for code to recognize the database models.

0 likes
12 replies
LaryAI's avatar
Level 58

In Laravel, the equivalent to Django's admin interface for managing models is not built-in, but there are several packages that can provide similar functionality. One popular choice is Laravel Nova, but since you mentioned FilamentPHP, I'll focus on that.

FilamentPHP is a lightweight admin panel for Laravel that allows you to manage your models with minimal setup. Here's a basic guide on how to get started with FilamentPHP:

  1. Install FilamentPHP:

    First, you need to install the Filament package via Composer. Run the following command in your terminal:

    composer require filament/filament
    
  2. Publish Filament Assets:

    After installation, you need to publish the Filament assets. This can be done using the following Artisan command:

    php artisan filament:install
    

    This command will publish the necessary configuration files and assets for Filament.

  3. Create a Filament Resource:

    Filament uses resources to manage your models. You can create a resource for a model using the following command:

    php artisan make:filament-resource Product
    

    This command will generate a resource class for your Product model, including the necessary files to manage it in the admin panel.

  4. Configure the Resource:

    Open the generated resource file located in app/Filament/Resources/ProductResource.php. Here, you can define the fields and actions for your model. For example:

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('name')
                    ->required(),
                TextInput::make('price')
                    ->numeric()
                    ->required(),
                Textarea::make('description'),
            ]);
    }
    
    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('name'),
                TextColumn::make('price'),
                TextColumn::make('created_at')
                    ->dateTime(),
            ])
            ->filters([
                //
            ]);
    }
    
  5. Access the Admin Panel:

    By default, Filament's admin panel is accessible at /admin. You can log in using the credentials of a user in your users table. Make sure the user has the necessary permissions to access the admin panel.

  6. Customize as Needed:

    Filament is highly customizable. You can add custom actions, filters, and more to tailor the admin panel to your needs.

FilamentPHP provides a clean and efficient way to manage your models in Laravel, similar to Django's admin interface. It's a great choice if you're looking for a lightweight and flexible solution.

1 like
vincent15000's avatar

I'm not sure to understand what you need.

A catalog of sort ? You mean filters ? Of perhaps you mean a sort of catalog ?

Filament is a collection of components and among the components there is an admin panel. But is it really what you need ?

1 like
tisuchi's avatar

@anjanesh I am a bit lost here!

The filamentPHP is a built-in panel that can help you to tailor based on your needs. Which means, you can do everything that you need without thinking of GUI for the admin panel.

1 like
anjanesh's avatar

I am going through FilamentPHP videos on laraveldaily. But just to clarify, in Django the Admin to add data to the backend comes by default and admin.py recognizes the structure just by 'looking' at models.py

In Laravel we just create migrations and models but there is no automatic detection of the database structure in nova or in FilamentPHP - or is there ? I would still need to define the editable fields in FilamentPHP's code right ?

"A catalog of sort ? You mean filters ? Of perhaps you mean a sort of catalog ?" - imagine a eCommerce site without the Add to Cart / Buy functionality.

1 like
tisuchi's avatar

@anjanesh here is my rephased understanding from you!

You have a database model with data. Now you want to use filament to follow this data model and data to build the admin.

You can achieve it. But you need to write your filamentphp components based on your data model. It won't detect your model automatically!. You have to tailor it.

1 like
anjanesh's avatar

I need a site which would just act as a catalog of products with backend for adding data and related images.

1 like
vincent15000's avatar

@anjanesh Oh ok ... But it's just CRUD. Why not simply write your own code ?

I know that Django has great functionalities to work with nested models, but there isn't this equivalent with Laravel.

You can have a look at some admin panels for Laravel, but I'm not sure that you will find exactly what you need.

https://backpackforlaravel.com/

https://nova.laravel.com/

Perhaps an idea to develop a package to do the same with Laravel ;).

anjanesh's avatar

"You can achieve it. But you need to write your filamentphp components based on your data model. It won't detect your model automatically!. You have to tailor it." - I see, ok.

"Oh ok ... But it's just CRUD. Why not simply write your own code ?" - I didn't have to write it in Django - thought I could skip doing that in Laravel too.

Thanks - I guess I'll create a minimal admin for this use case and use FilamentPHP for the general use cases.

1 like
anjanesh's avatar

@vincent15000 Learning Laravel one day at a time - now found this useful resource - filamentexamples.com

1 like
Batman55's avatar

@anjanesh Povilas Korop (Laravel Daily) has a lot of great resources on that site, youtube, and possibly his Laravel Daily site. If your new to Filament I would also highly suggest the course directed towards Filament newcomers here on Laracasts:

https://laracasts.com/series/rapid-laravel-development-with-filament

One thing is that you will want to use Laravel 11, and not 12. It may not make a difference in this course.

Also, read the docs at Filament.

Please or to participate in this conversation.