© 2026 Hedgehog Software, LLC

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

Avoid duplicate code

Good morning,

Lets say I have two resources:
-> Brands
-> Ingredients

Both have a relation with products. So for both resources I have separate a relationmanager to products.
Both relationmanagers have a table with the same code for table. My question is how what are ways to abstract this code so that I only have the tableoverview for products once?

Thanks.
Solution
You can basically do it however you want. One option is to create an invokable class that accepts $table and modifies it with columns etc. Then you can invoke that for each resource in the table method
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to avoid duplicate queries
FilamentFFilament / ❓┊help
2y ago
Is there a way to avoid duplicate afterStateUpdated methods ?
FilamentFFilament / ❓┊help
12mo ago
Optimizing Queries in FileUpload – How to Avoid Duplicate Calls?
FilamentFFilament / ❓┊help
14mo ago
Duplicate summarizer
FilamentFFilament / ❓┊help
15mo ago