FilamentF
Filament3y ago
Vp

infolist with relationship not working

I create infolist, play around with table and display in home page.. I can get actual record data and it displaying correct, but it cannot show relationship data.
My code:
public function lyricLists(Infolist $infolist): Infolist
{
    return $infolist
        ->state([
            'lyrics' => $this->getTableRecords(),
        ])
        ->schema([
            RepeatableEntry::make('lyrics')
                ->label('')
                ->schema([
                    TextEntry::make('album.name') // not working
                        ->label(''),
                    TextEntry::make('title') // working
                        ->label(''),
                    TextEntry::make('lyrics') // working
                        ->label(''),
                ]),
        ]);
}

public function table(Table $table): Table
{
    return $table
        ->query(
            Lyric::query()
                ->with('album')
                ->latest(),
        );
}

If I dd() inside table() and yes I got data with relationships, what should be the problem?
Solution
This happen because I have boolean column "album" cast to boolean, and relationship name "album".. I've changed to different name and it working fine
Was this page helpful?