© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•11mo ago•
6 replies
aldec

Get form state of 'parent' form inside a relationship

I have a helper function setting a label or visibility of form fields based spatie settings. Which setting is applicable is dependent on a property/form component. Inside my rather complex form I have multiple relationships. The helper functions try access the property of the 'parent' form via $get('myProperty'), but it is not accessible anymore. Can I traverse these form states?

function fieldVisibility(string $fieldKey): Closure
    {
        return function (callable $get) use ($fieldKey) {
            $settings = app(RoadworksSettings::class);
            $applicationType = $get('type');
            $applicationTypeKey = Str::slug($applicationType, '_');
            return $settings->fieldConfigurations[$applicationTypeKey][$fieldKey]['visible'] ?? true;
        };
    }
function fieldVisibility(string $fieldKey): Closure
    {
        return function (callable $get) use ($fieldKey) {
            $settings = app(RoadworksSettings::class);
            $applicationType = $get('type');
            $applicationTypeKey = Str::slug($applicationType, '_');
            return $settings->fieldConfigurations[$applicationTypeKey][$fieldKey]['visible'] ?? true;
        };
    }
Solution
$get('../type') or ../../type etc
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

getting parent relationship in form
FilamentFFilament / ❓┊help
3y ago
Using $get to get the state of parent form fields in repeaters
FilamentFFilament / ❓┊help
2y ago
Get the parent id inside child repeater form
FilamentFFilament / ❓┊help
2y ago
Get parent data inside a repeater
FilamentFFilament / ❓┊help
3y ago