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()
but it keep telling me "Filament\Widgets\TableWidget::getTableRecordKey(): Return value must be of type string, null returned"
Advice appreciated. Thanks!
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!