This repository was archived by the owner on Jun 27, 2024. It is now read-only.
This repository was archived by the owner on Jun 27, 2024. It is now read-only.
Can I able to add query the table based on groupBy #74
Open
Description
I need to create a table based on groupby, count it based on the value and show it in the table
` $globalSearch = AllowedFilter::callback('global', function ($query, $value) {
$query->where(function ($query) use ($value) {
$query->orWhere('term', 'LIKE', "%{$value}%");
});
});
$activities = QueryBuilder::for(Activity::select('term', DB::raw('count(*) as total'))
->groupBy('term'))
->defaultSort('term')
->allowedSorts(['term'])
->allowedFilters(['term', $globalSearch])
->paginate()
->withQueryString();
return Inertia::render('Dashboard', [
'activities' => $activities,
])->table(function (InertiaTable $table) {
$table->withGlobalSearch()
->defaultSort('term')
->column(key: 'term', searchable: true, sortable: true, canBeHidden: false);
});`
Metadata
Metadata
Assignees
Labels
No labels