© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Fonz

Custom column to display a pivot of the current user and tenancy relationship

I would like to display a boolean column of the users and the currenty tenant relation in a table and I am a bit lost. Can someone point me to the right direction? Thanks
Solution
With a bit of help from chatgpt:

User.php
public function getAcceptedForCurrentTenantAttribute()
    {
        $userTenant = $this->tenants->firstWhere('id', \Filament\Facades\Filament::getTenant()->id);
        return $userTenant ? $userTenant->pivot->accepted : 'N/A';
    }
public function getAcceptedForCurrentTenantAttribute()
    {
        $userTenant = $this->tenants->firstWhere('id', \Filament\Facades\Filament::getTenant()->id);
        return $userTenant ? $userTenant->pivot->accepted : 'N/A';
    }

UserResource.php
TextColumn::make('Accepted for Current Tenant', 'acceptedForCurrentTenant')
TextColumn::make('Accepted for Current Tenant', 'acceptedForCurrentTenant')


This seems to work
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

Display count of relationship in table column where pivot value = something
FilamentFFilament / ❓┊help
3y ago
Add Current User to Pivot on save.
FilamentFFilament / ❓┊help
3y ago
Tenancy pivot columns
FilamentFFilament / ❓┊help
3y ago
Display relationship on table column
FilamentFFilament / ❓┊help
3y ago