F
Filament4mo ago
BBB

TextColumn N+1 official demo

Hi, From official : https://github.com/filamentphp/demo/blob/a940c5a2c26a2a943273c526127a90c03ced6567/app/Filament/Resources/Shop/CustomerResource.php#L86
Tables\Columns\TextColumn::make('country')
->getStateUsing(fn ($record): ?string => Country::find($record->addresses->first()?->country)?->name ?? null)
Tables\Columns\TextColumn::make('country')
->getStateUsing(fn ($record): ?string => Country::find($record->addresses->first()?->country)?->name ?? null)
Is it okay to do that? Won't it make a query for each row? Thank you
GitHub
demo/app/Filament/Resources/Shop/CustomerResource.php at a940c5a2c2...
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
0 Replies
No replies yetBe the first to reply to this messageJoin