Hide component in infolist conditionally

Hi, i'm trying to hide component in infolist if the relation is empty my code (that show the relation) is this
Components\Section::make('Company')
->schema([
Components\Split::make([
Components\Grid::make(4)
->schema([
Components\TextEntry::make('company.name')->label('Company name'),
Components\TextEntry::make('company.address')->label('Address'),
Components\TextEntry::make('company.city')->label('City'),
Components\TextEntry::make('company.province')->label('Province'),
Components\TextEntry::make('company.cap')->label('Zip'),
Components\TextEntry::make('company.piva')->label('Vat'),
Components\TextEntry::make('company.cf')->label('Fiscal code'),
Components\TextEntry::make('company.codice_destinatario')->label('COD')
])
])
])
->hidden(?????)
->collapsible(),
Components\Section::make('Company')
->schema([
Components\Split::make([
Components\Grid::make(4)
->schema([
Components\TextEntry::make('company.name')->label('Company name'),
Components\TextEntry::make('company.address')->label('Address'),
Components\TextEntry::make('company.city')->label('City'),
Components\TextEntry::make('company.province')->label('Province'),
Components\TextEntry::make('company.cap')->label('Zip'),
Components\TextEntry::make('company.piva')->label('Vat'),
Components\TextEntry::make('company.cf')->label('Fiscal code'),
Components\TextEntry::make('company.codice_destinatario')->label('COD')
])
])
])
->hidden(?????)
->collapsible(),
what should the condition be like in hidden?
2 Replies
Dennis Koch
Dennis Koch7mo ago
fn ($record) => $record->company === null)
Soundmit
Soundmit7mo ago
seem doesn't works dumping $infolist->record->company, i saw the relation nevermind... i made a relation manager and it's better