PHP code example of asignua / filament-group-summaries

1. Go to this page and download the library: Download asignua/filament-group-summaries library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asignua / filament-group-summaries example snippets


use Asignua\FilamentGroupSummaries\GroupSummariesPlugin;

$panel->plugin(GroupSummariesPlugin::make());

use Asignua\FilamentGroupSummaries\SummaryGroup;
use Filament\Tables\Columns\Summarizers\Sum;

$table
    ->columns([
        TextColumn::make('status'),
        TextColumn::make('amount')->summarize(Sum::make()->label('Total')),
    ])
    ->groups([
        SummaryGroup::make('status')
            ->collapsible()
            ->summariesInHeader()     // Sum / Average / Count / Range / Values / custom, per group
            ->hideTrailingSummary()   // drop the row Filament draws after each group
            ->defaultDirection('desc'),
    ]);