getTableQuery using groupBy

Hello, I have been trying to create a table using getTableQuery() for Widget. What I want to do is make the table show Monday - Sunday on the column with application count under each date. I currently have this query in getTableQuery() return Application::selectRaw('COUNT(id) as count, DAYOFWEEK(created_at) as dayOfWeek') ->whereYear('created_at', date('Y')) ->groupBy(DB::raw('DAYOFWEEK(created_at)')); but it keep telling me "Filament\Widgets\TableWidget::getTableRecordKey(): Return value must be of type string, null returned" Advice appreciated. Thanks!
3 Replies
toeknee
toeknee15mo ago
Try: return Application::selectRaw('COUNT(id) as count, DAYOFWEEK(created_at) as dayOfWeek') ->whereYear('created_at', date('Y')) ->whereNotNull('created_at') ->groupBy(DB::raw('DAYOFWEEK(created_at)')) ->orderBy(DB::raw('DAYOFWEEK(created_at)')); I suspect you are returning some null results.
Dan Harrin
Dan Harrin15mo ago
i really doubt either of these work the results have to be eloquent models if eloquent cant hydrate models then the table wont work
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server
More Posts