© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
Soundmit

Get the item id in getRelations

I need to show the relation manager if the relation exists
i have this code, and works but the id is fixed a 1 (for test)
how do i get the item id? $this is not available

public static function getRelations(): array
    {   
        $customer = Customer::find(1);
        $repairs = $customer->repairs()->count();
        $companies = $customer->companies()->count();
        $relations = [];
        if($repairs > 0) {
            $relations[] = RelationManagers\RepairsRelationManager::Class;
        }
        if($companies > 0)  {
            $relations[] = RelationManagers\CompaniesRelationManager::Class;
        }

        return $relations;
    }
public static function getRelations(): array
    {   
        $customer = Customer::find(1);
        $repairs = $customer->repairs()->count();
        $companies = $customer->companies()->count();
        $relations = [];
        if($repairs > 0) {
            $relations[] = RelationManagers\RepairsRelationManager::Class;
        }
        if($companies > 0)  {
            $relations[] = RelationManagers\CompaniesRelationManager::Class;
        }

        return $relations;
    }
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

get choosen item id
FilamentFFilament / ❓┊help
2y ago
GetRelations another getrelations
FilamentFFilament / ❓┊help
17mo ago
Repeater item id
FilamentFFilament / ❓┊help
2y ago
Is it possible to get the future id of item in repeater?
FilamentFFilament / ❓┊help
3y ago