public static function table(Table $table): Table
{
->filters([
SelectFilter::make('game')
->label('Game')
->options(GameEnum::class)
->query(function ($query) {
})
])
}
#[Override]
public static function getEloquentQuery(): Builder
{
$tableFilters = request()->query('tableFilters');
$game = isset($tableFilters['game']['value']) ? $tableFilters['game']['value'] : null;
return parent::getEloquentQuery()
->select('users.*')
->leftJoinSub(
\DB::table('othertable')
->select('custom_column_id', \DB::raw('COUNT(*) as count'))
->when($game, function ($query, $game) {
$query->where('enquiry->game', $game);
})
->groupBy('custom_column_id'),
'counts',
function ($join) {
$join->on('users.id', '=', 'counts.match_id');
}
)
.....
public static function table(Table $table): Table
{
->filters([
SelectFilter::make('game')
->label('Game')
->options(GameEnum::class)
->query(function ($query) {
})
])
}
#[Override]
public static function getEloquentQuery(): Builder
{
$tableFilters = request()->query('tableFilters');
$game = isset($tableFilters['game']['value']) ? $tableFilters['game']['value'] : null;
return parent::getEloquentQuery()
->select('users.*')
->leftJoinSub(
\DB::table('othertable')
->select('custom_column_id', \DB::raw('COUNT(*) as count'))
->when($game, function ($query, $game) {
$query->where('enquiry->game', $game);
})
->groupBy('custom_column_id'),
'counts',
function ($join) {
$join->on('users.id', '=', 'counts.match_id');
}
)
.....