© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
5 replies
Frittenfred

Filter from Accessor

Hello Together,

i'm using Laravel Venture for Workflow Jobs, and i have set in my model a Accessor. That gives me for every row a output if the workflow is running or failed or was canceled as string.

in my Table in Filament this works very well and every row has his Data from the Accessor.

now i want to implement a filter to the Table where i can filter via the accessor string, but this don't work out until now.

this is my Accessor in the Model :

    public function getWorkflowStatusAttribute()
    {
        if ($this->cancelled_at != Null) {
            return 'Abgebrochen';
        } else if ($this->failedJobs()->isNotEmpty()) {
            return 'Fehlgeschlagen';
        } else if (!$this->allJobsHaveFinished()) {
            return 'Läuft';
        } else if ($this->allJobsHaveFinished()) {
            return 'Abgeschlossen';
        }
    }
    public function getWorkflowStatusAttribute()
    {
        if ($this->cancelled_at != Null) {
            return 'Abgebrochen';
        } else if ($this->failedJobs()->isNotEmpty()) {
            return 'Fehlgeschlagen';
        } else if (!$this->allJobsHaveFinished()) {
            return 'Läuft';
        } else if ($this->allJobsHaveFinished()) {
            return 'Abgeschlossen';
        }
    }


any idea how i can filter by the returned Strings ? 🙂

Thanks
Solution
@Frittenfred it doesn't work for a reason: accessors are called and values formed AFTER the main query of Eloquent which contains all the filtering.

Maybe you can make filters work by reworking how your accessors work to make the same logic called in a custom filter but it's quite a "hacky" way.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How-to create table filter from model accessor
FilamentFFilament / ❓┊help
2y ago
Custom filter forms (From - Until Filter)
FilamentFFilament / ❓┊help
3y ago
BelongsToMany Full Name Accessor
FilamentFFilament / ❓┊help
16mo ago
Table with accessor content
FilamentFFilament / ❓┊help
3y ago