© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
4 replies
CORONEL

Get active relation manager table filters from custom page

Is there any straightforward way to access the instance of the active relation manager from my custom page? I'm trying to make the custom page to respond to certain relation manager "events" like when a filter is applied, or the active relation manager changes. Is this the right approach? Or perhaps i should invert the logic, and fire events from the relation managers itselves. Any insight will be greatly appreciated!
Solution
For anyone having the same questions, i'll post what i ended up doing. What i wanted was to get the relation manager table filters from my custom page which they were shown. My solution was the following:

I'm using
AnourValar\EloquentSerialize
AnourValar\EloquentSerialize
library to serialize the query builder and save it to the application cache. So in the Relation Manager table, i do the following:

$table...->filtersApplyAction(function ($livewire) {
                $serialized = EloquentSerializeFacade::serialize($livewire->getFilteredTableQuery());
                Cache::put(get_class($livewire), $serialized);
                $livewire->dispatch('refreshPage');
            })
$table...->filtersApplyAction(function ($livewire) {
                $serialized = EloquentSerializeFacade::serialize($livewire->getFilteredTableQuery());
                Cache::put(get_class($livewire), $serialized);
                $livewire->dispatch('refreshPage');
            })

And in my custom page, i have the following:

protected $listeners = ['refreshPage' => '$refresh'];

public function myMethodWhereINeedTheFilters(){
$activeRelationManager = $this->getRelationManagers()[$this->activeRelationManager];
        $filtered = null;
        try {
            $filtered =  EloquentSerializeFacade::unserialize(Cache::get($activeRelationManager));
        } catch (Exception $e) {
        }
        // dd($filtered);

        if ($filtered) {
            $pointsQuery = $filtered;
        } else {
            $pointsQuery = $this->record->points();
        }

        $data = $pointsQuery->get();
}
protected $listeners = ['refreshPage' => '$refresh'];

public function myMethodWhereINeedTheFilters(){
$activeRelationManager = $this->getRelationManagers()[$this->activeRelationManager];
        $filtered = null;
        try {
            $filtered =  EloquentSerializeFacade::unserialize(Cache::get($activeRelationManager));
        } catch (Exception $e) {
        }
        // dd($filtered);

        if ($filtered) {
            $pointsQuery = $filtered;
        } else {
            $pointsQuery = $this->record->points();
        }

        $data = $pointsQuery->get();
}
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

Relation manager in custom page
FilamentFFilament / ❓┊help
3y ago
Remove "Active filters" bar from table
FilamentFFilament / ❓┊help
3y ago
How to open custom page from relation manager
FilamentFFilament / ❓┊help
15mo ago
rendering Relation Manager table on a custom blade page
FilamentFFilament / ❓┊help
2y ago