© 2026 Hedgehog Software, LLC
<?php namespace App\Filament\Widgets; use App\Models\TradingProfile; use Filament\Tables; use Filament\Widgets\TableWidget as BaseWidget; use Illuminate\Database\Eloquent\Builder; use Filament\Tables\Columns\TextColumn; use Illuminate\Support\Facades\DB; class TradingProfileSales extends BaseWidget { protected static ?int $sort = 2; protected function getTableHeading(): string|null { return 'Product Sales'; } protected function getTableQuery(): Builder { return TradingProfile::selectRaw('product_id, SUM(price) as total_price') ->groupBy('product_id'); } protected function getTableColumns(): array { return [ TextColumn::make('product.name') ->label('Product Name'), TextColumn::make('total_price') ->label('Total Sales'), ]; } protected function isTablePaginationEnabled(): bool { return false; } }
Join the Discord to ask follow-up questions and connect with the community
A powerful open-source UI framework for Laravel • Build and ship apps & admin panels fast with Livewire
20,181 Members