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

kikloo's avatar

Filament showing empty form

Hi,

I'm new to Laravel and Filament and I'm doing Rapid Laravel Ddevelopment with Filament series. Instead of doing exactly as video tutorials, I'm creating my own as I need so I understand how it works, all is working fine, I'm able to create tables etc.

But when I did the resource --generate command and logged into the admin panel, I don't see the fields in the form. I've created a Server model and below is my yaml schema:

models: Server: name: string hostname: string ip: string assigned_ips: text noc: string cost: decimal:10,2 max_accounts: unsignedInteger nullable nameservers: text module: string username: string password: string api_token: string use_secure: unsignedInteger nullable port: unsignedInteger nullable status: string

I see blank form with 3 buttons Create, Create & create another, cancel.

What is wrong ? Any help is appreciated.

Thanks.

0 likes
4 replies
LaryAI's avatar
Level 58

It sounds like you've successfully generated a resource using Filament, but the form fields are not displaying as expected. This could be due to a few reasons, but let's start by ensuring that your form fields are properly defined in your resource's Form schema.

Here's what you should check:

  1. Ensure that you have the form method defined in your ServerResource.php file, and that it returns a Form schema with fields that correspond to your model's attributes.

  2. Make sure that the fields are correctly set up to match the column types and names in your database.

  3. Check if you have any access control (like policies) that might be preventing the fields from being displayed.

Here's an example of how your form method might look in your ServerResource.php file:

use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\Toggle;
use Filament\Forms\Components\Select;

class ServerResource extends Resource
{
    // ...

    public static function form(Form $form)
    {
        return $form->schema([
            TextInput::make('name')->required(),
            TextInput::make('hostname')->required(),
            TextInput::make('ip')->required(),
            Textarea::make('assigned_ips'),
            TextInput::make('noc'),
            TextInput::make('cost')->numeric()->required(),
            TextInput::make('max_accounts')->nullable(),
            Textarea::make('nameservers'),
            TextInput::make('module')->required(),
            TextInput::make('username')->required(),
            TextInput::make('password')->password(),
            TextInput::make('api_token'),
            Toggle::make('use_secure')->offValue(0)->onValue(1),
            TextInput::make('port')->numeric()->nullable(),
            Select::make('status')->options([
                'active' => 'Active',
                'inactive' => 'Inactive',
                // Add other statuses as needed
            ])->required(),
        ]);
    }

    // ...
}

Make sure that each field type is appropriate for the data you expect to handle. For example, use TextInput for strings, Textarea for text, Toggle for boolean-like fields, and Select for fields with predefined options.

If you've confirmed that the form method is correctly set up and you're still seeing an empty form, try clearing your cache with the following command:

php artisan optimize:clear

This will clear the application cache, route cache, view cache, and other caches that might be causing the issue.

If the problem persists after these steps, you may want to check the Filament documentation or seek further assistance from the Filament community, as there might be a more specific issue at play with your setup.

lulzshadowwalker's avatar

Hey, most likely you might have forgotten to define the $fillable property inside the model classes. At least this was the case for me šŸ¤” Good luck and happy learning!

CodyMcCode's avatar

@kikloo

I know it's been a while and I presume this is all sorted. But just had the same issue so posting for other who may find this.

If you'd like to save time, Filament can automatically generate the form and table for you, based on your model's database columns, using --generate:

php artisan make:filament-resource Customer --generate

It's easier to then edit and trim the form from there most probably. You probably missed the --generate flag?

syahril's avatar

If you are experiencing this problem, confirm that you have executed the php artisan migrate command, even if the $fillable property has been defined. Only then will it be properly generated by FIlament.

Please or to participate in this conversation.