FilamentF
Filament2y ago
Mina

filter query join is not working for me

so, I am trying to make a filter with join on another table. The query is working fine but for some reason it's not working in filament. Do you have any idea why and if this is even possible to do, I really need this functionality on my page:
Tables\Filters\Filter::make('least_money_made')->query(function (Builder $query) { return $query->select('funnels.*') ->leftJoin('orders', 'funnels.id', '=', 'orders.funnel_id') ->selectRaw('COALESCE(SUM(orders.total_price), 0) AS total_money_made') ->groupBy('funnels.id') ->orderBy('total_money_made', 'ASC') ->limit(1); });
Was this page helpful?