© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•8mo ago•
3 replies
影の人

Undefined property: App\Filament\Pages\SettingsPage::$form

    class SettingsPage extends Page implements HasForms
{

    use InteractsWithForms;

    protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';

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

    public ?array $data = [];

    public function mount(): void
    {
        $settings = ModelsSettings::first() ?? new ModelsSettings();
        $this->form->fill($settings->toArray());
    }

    public function form(Form $form): Form
    {
        return $form
            ->schema([
.....
            ])
            ->statePath('data')
            ->model(ModelsSettings::class);
    }

    protected function getFormActions(): array
    {
        return [
            Action::make('save')
                ->label('Save')
                ->submit('save'),
        ];
    }

    public function save()
    {
        $data = $this->form->getState();
        dd($data);
        $settings = ModelsSettings::first() ?? new ModelsSettings();
        $settings->fill($data);
        $settings->save();

        Notification::make()
            ->title('Settings saved successfully')
            ->success()
            ->send();
    }

   
}
    class SettingsPage extends Page implements HasForms
{

    use InteractsWithForms;

    protected static ?string $navigationIcon = 'heroicon-o-cog-6-tooth';

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

    public ?array $data = [];

    public function mount(): void
    {
        $settings = ModelsSettings::first() ?? new ModelsSettings();
        $this->form->fill($settings->toArray());
    }

    public function form(Form $form): Form
    {
        return $form
            ->schema([
.....
            ])
            ->statePath('data')
            ->model(ModelsSettings::class);
    }

    protected function getFormActions(): array
    {
        return [
            Action::make('save')
                ->label('Save')
                ->submit('save'),
        ];
    }

    public function save()
    {
        $data = $this->form->getState();
        dd($data);
        $settings = ModelsSettings::first() ?? new ModelsSettings();
        $settings->fill($data);
        $settings->save();

        Notification::make()
            ->title('Settings saved successfully')
            ->success()
            ->send();
    }

   
}

i need to understand why it doesn't work before a solution, because i've set the form already so what is making filamentphp not recognizing it , any help is appreciated
Solution
for some reason just refreshing the page solved the problem lol got no idea what happen
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Access to an undefined property $form
FilamentFFilament / ❓┊help
3y ago
Property [$form] not found on component: [app.filament.resources.process-resource.pages.view-process
FilamentFFilament / ❓┊help
3y ago
phpstan: Access to an undefined property App\Livewire\RegisterPage::$form.
FilamentFFilament / ❓┊help
3y ago