show total sum by filters
I have blade file where i'm showing my total sum and total part sum.. i want to show sum of all column table.
20 Replies
Like in
Total Sum
i want show all total and in Total part Sum
i want show all total part sum
also i have filter and when i filter i want to re render and show new total sum of this showed columns
anyone please ((
??Please refer https://github.com/filamentphp/demo/blob/main/app/Filament/Resources/Shop/OrderResource.php
GitHub
demo/app/Filament/Resources/Shop/OrderResource.php at main · filame...
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.
this is my blade
and this is my list resource file
i just want to take totalSum and totalpartSum
I think you need summarize(): https://filamentphp.com/docs/3.x/tables/summaries
i dont have total column in my table
like in my table i have many inputs i just take all this input and make sum in my code
this is my table btw
``````
there is my table code
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'non_commercials.total' in 'field list' (Connection: mysql, SQL: select sum(non_commercials.total_part) as "lNxh3bBabCUXw2R8" from (select * from
non_commercials
) as non_commercials
)
i dont have total in my table
is it nessesary ?
like im saving total only in my code not dbuse only
for table? or for textColumn
for table i have error
Method Filament\Tables\Table::summarize does not exist.
and for textColumns its write to its doesnt exist
?for column
``````
like that?
yes
test it once
i have this error
without
summarize
its works btwtry with using function same as you use for get column record
how can u write it please?
??
i try ->summarize(function ($records) {
return $records->sum('amount'); // Summing the 'amount' field from the records
}) like this but not working
okay i wil ltry thanks
thats working thanks!
i just use custom summarize
->summarize(Summarizer::make()
->label('გადახდილი ჯამი')
->using(function (Builder $query) {}