© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
18 replies
Quin.

Custom page that's create a record

Hello i am trying to make a custom page that has a form that can create a record for my model. Unfornatly it is not working right now. I can't find the best example on the internet someone can help?


class RequestDomainPage extends Page implements HasForms
{

    use InteractsWithForms;

    protected static ?string $model = RequestDomain::class;
    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    protected static string $view = 'filament.pages.request-domain-page';

    protected static ?string $title = 'Domein aanvragen';


    public $domain;
    public $customer_id;


    public function mount(): void
    {
        $this->form->fill();
    }

    protected function getFormSchema(): array
    {
        return [
          Card::make()->schema([
              TextInput::make('domain')
                  ->label('Domain')
                  ->required(),
              Select::make('customer_id')
                  ->label('Customer')
                  ->placeholder('Select Customer')
                  ->options(
                      \App\Models\Customer::all()->pluck('name', 'id')
                  )
                  ->required(),
          ])
        ];
    }
    protected function getFormActions(): array
    {
        return [
           Action::make('kak')
                    ->label('Submit')
                    ->action(function (RequestDomain $requestDomain) {
                       RequestDomain::create([
                           'domain' => $this->domain,
                           'customer_id' => $this->customer_id
                       ]);
                    }),
        ];
    }
}
class RequestDomainPage extends Page implements HasForms
{

    use InteractsWithForms;

    protected static ?string $model = RequestDomain::class;
    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    protected static string $view = 'filament.pages.request-domain-page';

    protected static ?string $title = 'Domein aanvragen';


    public $domain;
    public $customer_id;


    public function mount(): void
    {
        $this->form->fill();
    }

    protected function getFormSchema(): array
    {
        return [
          Card::make()->schema([
              TextInput::make('domain')
                  ->label('Domain')
                  ->required(),
              Select::make('customer_id')
                  ->label('Customer')
                  ->placeholder('Select Customer')
                  ->options(
                      \App\Models\Customer::all()->pluck('name', 'id')
                  )
                  ->required(),
          ])
        ];
    }
    protected function getFormActions(): array
    {
        return [
           Action::make('kak')
                    ->label('Submit')
                    ->action(function (RequestDomain $requestDomain) {
                       RequestDomain::create([
                           'domain' => $this->domain,
                           'customer_id' => $this->customer_id
                       ]);
                    }),
        ];
    }
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Custom record pass to recordActions of resource page
FilamentFFilament / ❓┊help
4mo ago
Require validation in a create record page
FilamentFFilament / ❓┊help
7mo ago
Custom page with record update
FilamentFFilament / ❓┊help
3y ago
Get record in custom page
FilamentFFilament / ❓┊help
3y ago