© 2026 Hedgehog Software, LLC

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

Hide column in relationmanager based on parent model

I've Ctrl+F'ed through the server in the hopes that I could find a solution, but unfortunately couldn't find a result that solved my issue. I'm trying to hide a column in a RelationManager if the parent record has a specific import_type, but I couldn't figure out how to pull this off since the table method is static, and the getOwnerRecord isn't. Any suggestions? Thanks in advance!

Tables\Columns\TextColumn::make('total_quantity')
                    ->suffix(' points')
                    ->hidden($this->getOwnerRecord()->import_type->hasCustomUnitPricing())
                    ->formatStateUsing(fn(?string $state): string => (double) $state)
                    ->sortable(),
Tables\Columns\TextColumn::make('total_quantity')
                    ->suffix(' points')
                    ->hidden($this->getOwnerRecord()->import_type->hasCustomUnitPricing())
                    ->formatStateUsing(fn(?string $state): string => (double) $state)
                    ->sortable(),


This was what I had in mind, but this unfortunately doesn't work since I can't use $this in a static function.
Solution
This could work:

->hidden(
  fn ($livewire) => $livewire->getOwnerRecord()
    ->import_type
    ->hasCustomUnitPricing()
)
->hidden(
  fn ($livewire) => $livewire->getOwnerRecord()
    ->import_type
    ->hasCustomUnitPricing()
)
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

Hide RelationManager card based on certain condition
FilamentFFilament / ❓┊help
3y ago
Hide Column Based on Active Group?
FilamentFFilament / ❓┊help
10mo ago
Hide Actions on RelationManager
FilamentFFilament / ❓┊help
2y ago
Hide a Column based on getTabs() selection
FilamentFFilament / ❓┊help
12mo ago