When to use a relation manager?

Hi everyone, I’m curious about the best practices for when to use a relation manager instead of a resource in Filament. For instance, if a model has a BelongsToMany relationship (e.g., with a Tag model), would it make sense to use a relation manager in that case? Or is it common practice to use both a relation manager and a resource for the same relationship? Any guidance on this would be appreciated! Thanks.
4 Replies
LeandroFerreira
LeandroFerreira2mo ago
make sense to use a relation manager in that case? yes relation managers provide a way to manage relationships without leaving the resource's Edit or View page.
Matthew
Matthew2mo ago
+1 on this, to be fair, I haven't looked into properly yet, but from first view I've not grasped why the relations I would define on my model are lacking something that would mean I need to define the relation within the resource as well. If anyone knows of any good tutorials, please point us at them! Thanks
Lara Zeus
Lara Zeus2mo ago
user have comments, ues use a relation manager, so the user can edit delete search and all other table actions but for a post belong to one or many tags, no a select in form and textColumn with badge is more than enough. but at the end every app has its own needs not sure what you mean:
lacking something
the relation in the model to defaind the relation on the database level for quiring etc, thwn you till filament using a relation manager how you're structring you model relation, so filament can work its magick to provide everything else (create,add,attach etc)
Matthew
Matthew2mo ago
TBH...I haven't got much further than having to list and enter new rows, that don't need much in the way of populating child tables.
TextColumn(childTable.childColumn)
TextColumn(childTable.childColumn)
Seems to work for table columns. So I guess I'll have to find out what I need the rest of it for a little later down the road. Edit: I've just watched the Laracasts on this section again (https://laracasts.com/series/rapid-laravel-development-with-filament/episodes/13?referer=DanHarrin), and I can probably see now what I'll need it for.
Want results from more Discord servers?
Add your server