Sum of fee column in table footer

I have two tables students and student_fees , in student list page, i am showing student information with fee also, i use getTableContentFooter() to show the sum of fee column but it show 0.
7 Replies
moaaz_m_f
moaaz_m_f2y ago
Filament
Aggregate data in table footer (sum, avg...etc) by moaaz faracheh -...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
skpi4u
skpi4uOP2y ago
i have seen this, my fee data has com form relationship, that's why it show only 0. how can show sum of fee for relationship table
moaaz_m_f
moaaz_m_f2y ago
I will update the trick soon to include this option and make it more clear for the relationship tables The idea is after adding the view dont add the rest of the code in the
instead just add the rest of code including
instead just add the rest of code including
getTableContentFooter()
in the
in the
ExampleRelationManager``` class file which has the table and form. that will do. let me know if works
skpi4u
skpi4uOP2y ago
it's sum the value but on RelationManager view but not on the StudentList Resource view
moaaz_m_f
moaaz_m_f2y ago
If you can share the code that is giving you zero also.
skpi4u
skpi4uOP2y ago
the list resource <?php namespace App\Filament\Resources\StudentResource\Pages; use App\Filament\Resources\StudentResource; use Filament\Pages\Actions; use Filament\Resources\Pages\ListRecords; use Filament\Tables\Filters\Layout; use Closure; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Builder; use App\Models\Student; use App\Models\StudentCourse; use Illuminate\Contracts\View\View; class ListStudents extends ListRecords { protected static string $resource = StudentResource::class; protected function getActions(): array { return [ Actions\CreateAction::make(), ]; } /protected function getTableFiltersLayout(): ?string { return Layout::AboveContent; }/
protected function getTableQuery(): Builder { return Student::query()->where('status', '=', 1); }
public array $data_list= [ 'calc_columns' => [ 'student_course.admission_fee', 'student_course.fee', 'student_course.advance', ], ]; protected function getTableContentFooter(): ?View { return view('tables.footer.student-footer', $this->data_list); } }
skpi4u
skpi4uOP2y ago
The relation manager file
Want results from more Discord servers?
Add your server