errer
Tables\Columns\TextColumn::make('Books')->getValueUsing(
function ($author) {
return (string)$author->books()->count();
}
),
but I have this erreur
Method Filament\Tables\Columns\TextColumn::getValueUsing does not exist.
but I add use Filament\Tables\Columns\getValueUsing;
and have some erreur
10 Replies
but I add use Filament\Tables\Columns\getValueUsing;Where did you get this from? That doesn't exist? Are you posting random ChatGPT code? 🤔
no
i use code in this website https://laravel.sillo.org/laravel-filament/
bestmomo
Laravel
Laravel Filament
Il existe un certain nombre de packages pour créer une administration pour Laravel dont l’officiel Nova (qui est payant). J’ai déjà parlé dans ce blog de Voyager, Orchid et Infyom. Je d…
i make all chapitre but last chapitre its get value
Have a look at that screenshot. It's from Filament v1. We are at v3 now 😉
can you tel my how this function in v3 Tables\Columns\TextColumn::make('Books')->getValueUsing(
function ($author) {
return (string)$author->books()->count();
}
),
getStateUsing()
Also it would be quite inefficient to calculate counts like this. It’s better to make it part of the query using an aggregate (
withCount
) for example.some erreur
If you have an error, share it. How do you expect us to help otherwise?
And as Eric suggested this is very inefficient. Have a look at the
count()
method