FilamentF
Filament2y ago
Flu

Computed Property Filter On Table Builder?

Hey, I'm using Filament Tables outside of Filament just to quickly bootstrap an app

I'm using a service and calling a method that returns an enum of strings, this shows fine in my table:

StatusColumn::make(name: 'status')
                    ->state(state: function (EmployeeService $employeeService, Employee $record): string {
                        return $status = $employeeService->calculateStatus($record)->value;
                    })


it's a computed property with a few nested many to many relationships and calculations to get the value

I'm trying to workout how I can add a filter for this property, does anyone have any examples or suggestions? It's not stored in the DB and has to be computed
Solution
Update:

I ended up wrapping it into a DTO as I needed to anyway and then using a Data Collection for my data using Sushi: https://filamentphp.com/community/how-to-consume-an-external-api-with-filament-tables
Filament
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
Was this page helpful?