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(),


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()
)
Was this page helpful?