© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
8 replies
dyo

Problem with formatStateUsing in TextColumn of custom table attribute

I just upgrading filament v2 to v3, but I got issue in textcolumn class with formatStateUsing method..
Tables\Columns\TextColumn::make('qty')->formatStateUsing(function ($record) {
    $qty = Konfirmasi::where('trans_ref', $record->id)->sukses()->count();
    return number_format($qty, 0);
}),
Tables\Columns\TextColumn::make('qty')->formatStateUsing(function ($record) {
    $qty = Konfirmasi::where('trans_ref', $record->id)->sukses()->count();
    return number_format($qty, 0);
}),

The qty attribute is not in table schema..
I need extra column to show the custom query..
In v2, the code above is working, but in v3, the column is returned blank..

What should I do to make it work in v3?
Solution
Or you can create Accessor (https://laravel.com/docs/11.x/eloquent-mutators#accessors-and-mutators) or local scope (https://laravel.com/docs/11.x/eloquent#local-scopes)
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

JSON TextColumn formatStateUsing badge repeats
FilamentFFilament / ❓┊help
3y ago
TextColumn->icon() disabled by formatStateUsing()
FilamentFFilament / ❓┊help
3y ago
formatStateUsing method in TextColumn is not working at the custom page
FilamentFFilament / ❓┊help
2y ago
Can't I give default in TextColumn formatStateUsing?
FilamentFFilament / ❓┊help
2y ago