© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
2 replies
Mark Chaney

Call to a member function isRelation() on null

I have the following createOptionAction where that I am getting that isRelation() on null error
->createOptionAction(function ($action, Get $get) {
    // hide the button to create a unit if this is a property that can't have multiple units
    $property = Property::find($get('property_id'));
    if ($property) {
        if (! $property->canHaveMultipleUnits()) {
            return $action->hidden();
        }

        return $action
            //->record(fn ($livewire) => $livewire->model)
            ->fillForm([
                'property_id' => $property->id,
            ])
            ->slideOver()
            ->modalWidth('7xl')
            ->modalHeading('Create Unit');
    }

    return $action->hidden();
})
->createOptionAction(function ($action, Get $get) {
    // hide the button to create a unit if this is a property that can't have multiple units
    $property = Property::find($get('property_id'));
    if ($property) {
        if (! $property->canHaveMultipleUnits()) {
            return $action->hidden();
        }

        return $action
            //->record(fn ($livewire) => $livewire->model)
            ->fillForm([
                'property_id' => $property->id,
            ])
            ->slideOver()
            ->modalWidth('7xl')
            ->modalHeading('Create Unit');
    }

    return $action->hidden();
})
. ->record() isnt available on this form action though, so i cant use it, which appears to be the solution for the issue. The problem is that in this form, I am trying to use a select with a relationship(), which throws that error. Recommendations?
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

Call to a member function isRelation() on null
FilamentFFilament / ❓┊help
11mo ago
Call to a member function isRelation() on null
FilamentFFilament / ❓┊help
3y ago
Call to a member function isRelation() on null' Error in Customized member registration page
FilamentFFilament / ❓┊help
15mo ago
Call to a member function getRelated() on null
FilamentFFilament / ❓┊help
5mo ago