table group only results in querying all records

This will be an issue if we have millions of records
10 Replies
Ricardo Sawir
Ricardo Sawir3mo ago
anyone?
Euu83
Euu833mo ago
Hello, you can use the methods query or modifyQueryUsing of the table for example call a the scope of model that you load in the resource public static function table(Table $table): Table { return $table->modifyQueryUsing(fn (Builder $query) => $query->balanceDays()) ->query(function () { $query->where('active','=',true) }) ->columns([ Tables\Columns\TextColumn::make('user_id_balance') ->alignRight() ->label('User')
Dennis Koch
Dennis Koch3mo ago
I don't even understand what's the issue
Ricardo Sawir
Ricardo Sawir3mo ago
When you enable the ->groupOnly(), you query all the models, provlematic when you have thousands of records
Dennis Koch
Dennis Koch3mo ago
So how do expect grouping to work otherwise?
Ricardo Sawir
Ricardo Sawir3mo ago
I think since this is group only, we can just select status, sum(), avg() from records group by status Instead of query all the records
Dennis Koch
Dennis Koch3mo ago
You still need to group them . But you are talking about summarizers now or what?
Ricardo Sawir
Ricardo Sawir3mo ago
Inthink its best to see the repo i submitted to demonstrate it
Ricardo Sawir
Ricardo Sawir3mo ago
GitHub
Group Only Table results in table querying all records · Issue #136...
Package filament/filament Package Version v3.2.40 Laravel Version v11.17.0 Livewire Version v3.5.4 PHP Version PHP 8.3.9 Problem description The app timeout when accessing Orders menu Expected beha...
Ricardo Sawir
Ricardo Sawir3mo ago
GitHub
GitHub - sawirricardo/filafun
Contribute to sawirricardo/filafun development by creating an account on GitHub.
Want results from more Discord servers?
Add your server