© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•12mo ago•
3 replies
TaufikRiontona

filtered colum value

I have table like this. I implement tahun and bulan filter but the timelines_rencana_count, timelines_realisasi_count did't work. What i miss?
message.txt6.2KB
Solution
Solved.

need to implement modifyqueryusing

->modifyQueryUsing(function (Builder $query, $livewire) {
$filter = @$livewire->tableFilters['Periode'];
if (!isset($filter['tahun'], $filter['bulan'])) {
return $query;
}

$date = Carbon::createFromFormat('Y-m-d', "{$filter['tahun']}-{$filter['bulan']}-01");
$startOfMonth = $date->startOfMonth();
$endOfMonth = $date->copy()->endOfMonth();

return $query->whereHas('timelinesRencana', function ($subQuery) use ($startOfMonth, $endOfMonth) {
$subQuery->whereBetween('date', [$startOfMonth, $endOfMonth]);
})->withCount([
'timelinesRencana' => function ($subQuery) use ($startOfMonth, $endOfMonth) {
$subQuery->whereBetween('date', [$startOfMonth, $endOfMonth]);
},
'timelinesRealisasi' => function ($subQuery) use ($startOfMonth, $endOfMonth) {
$subQuery->whereBetween('date', [$startOfMonth, $endOfMonth]);
}
]);
})
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Custom colum view
FilamentFFilament / ❓┊help
2y ago
Custom Exporter Colum
FilamentFFilament / ❓┊help
2y ago
Filtered Data
FilamentFFilament / ❓┊help
3y ago
Export filtered table
FilamentFFilament / ❓┊help
3y ago