F
Filament6mo ago
Steff

Is it possible to handle a description from a related table?

Is it possible to handle a description from a related table? The relationship is there.
Tables\Columns\TextColumn::make('name')
->description(fn(Table_1 $record): string => $record->table_2.field),
Tables\Columns\TextColumn::make('name')
->description(fn(Table_1 $record): string => $record->table_2.field),
( ->table_2.field doesnt work )
Solution:
do you mean $record->yourRelationship->field ?
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira6mo ago
should work. What is the error?
Steff
SteffOP6mo ago
This snippet ist in filament resource Table_1. The description should be come from Table_2. the error is a) phpstorm make blanks between table_2 . field and this can not work. If i try so, Undefined constant "App\Filament\Resources\name" I guess the syntax isnt right.
Solution
LeandroFerreira
LeandroFerreira6mo ago
do you mean $record->yourRelationship->field ?
Steff
SteffOP6mo ago
Yes.
Want results from more Discord servers?
Add your server