F
Filament2mo ago
Randak

Filament structure question

I’m a hobby coder. I’ve talked to two potential paid helpers for this phase of my Filament project and I’m not sure about their answers. Here is what I’m trying to accomplish: An /admin page for the user. The admin page will list (among other things) specific user’s game_instances. The user can be playing multiple games at the same time, all self-contained. When the user selects a game_instance (action), they are taken to a separate page for that game (I think of it, probably incorrectly, as an admin panel for that game). Each game_instance will use the same Filament Resources (so I don’t need different pages for each game). The page will show only that specific user’s Resources (for that specific game) and allow basic CRUD operations. QUESTION: Does the game_instance page need to be a custom-built page? (As opposed to setting up another basic panel—which I haven’t been able to get working.)
23 Replies
Randak
RandakOP2mo ago
Also, if there is an open source project that does this I'd love a link so I could see it in action. Thanks!
awcodes
awcodes2mo ago
Sounds like you just need a query scope when listing the game instance to only return instances owned by the user. If I’m understanding correctly.
Randak
RandakOP2mo ago
The game instances are listing fine on the admin panel. It is my attempts to then open another page (panel?) that contains all the resources for that user and specific game instance. Checking out query scopes now in any event, and thanks for your response.
awcodes
awcodes2mo ago
How are the non-admins viewing the instance?
Randak
RandakOP2mo ago
Each user is effectively an admin for this purpose, in that they can see their own information.
awcodes
awcodes2mo ago
Just trying to figure out the relationships without seeing the code. 😁 Wouldn’t it automatically be scoped then.
Randak
RandakOP2mo ago
Yeah, sorry if I don't explain it well. I have a large db diagram I can drop here if that would help?
awcodes
awcodes2mo ago
On the list page for the instances is it showing all instances or only the ones belonging to the user?
Randak
RandakOP2mo ago
The list of game instances is working fine. It's now going to a specific instance and seeing the resources and CRUD. I could also "public" my code on Github, but not sure if that would help.
awcodes
awcodes2mo ago
See my last question
Randak
RandakOP2mo ago
Just the ones belonging to that user.
awcodes
awcodes2mo ago
Then the edit/view pages are already scoped, right?
Randak
RandakOP2mo ago
Yes, edit and view pages work. Now I want to "click" on that instance and go to a page that shows that games resources: key person, ship, etc.
awcodes
awcodes2mo ago
If the user clicks on an edit/view action in the list then it loads an edit / view page with that records data. So all the information should just be available already and displayed with either the form or the infolist. I don’t think you need another page. It already works as is
Randak
RandakOP2mo ago
The info from the game_instance model is all present. Now I want another page that show's that game instances resources: Key People Ships etc. And each of those is a separate model and I want the user to access the CRUD for their resources.
awcodes
awcodes2mo ago
Look into relation managers in the docs.
Randak
RandakOP2mo ago
I will do so. I used those on my first project for my relationships, but didn't know it applied in this situation. I spoke to two separate people about paying for the basic build (one experienced but not in Filament, the other knows Filament but seemed junior) and they both suggested I might need a custom Livewire/Filament page. I don't mind paying for it, but I want to make sure I'm going down the right path. Once again I appreciate your time, I know it is valuable.
awcodes
awcodes2mo ago
It’s possible you need a custom page, but nothing you’ve said so far would lead me down that path.
Randak
RandakOP2mo ago
It seems I wouldn't, but my ignorance is vast. I looked at relationship managers again, but I'm not sure they get me to where I want to be. I used them in my other project and it was great for those many-to-many attach/detach actions, but this is about having a separate admin or control panel/page for those resources. I think the confusing part is how the game's resources are accessed. I would want a user/player to open up a game instance page (from /admin) and have it look like Filament's default admin panel. The left side Navigation Group would contain those game specific resources (key persons, ships, etc.). I could then click on a resource (e.g. Ships) and get the list, which contained the CRUD. The "game" page will contain over 40 resources. Plus it would be great to use some widgets (which I haven't used yet) or other features to show other information specific to that game.
awcodes
awcodes2mo ago
Ok, but the key persons, ships, etc are just relationships to the game instance. So with a relationship manger they are scoped by default. I don’t see the need for anything custom.
Randak
RandakOP2mo ago
I'll experiment with it. If I can't get there, any recommendations for a junior Filament dev (for cost purposes) I could hire for the basic infrastructure help?
awcodes
awcodes2mo ago
Sorry, no recommendations. I don’t know that a “filament developer” is an actual thing at any level. But filament is still just laravel.
Randak
RandakOP2mo ago
Bummer, it was worth a try! I love Filament but I have much to learn... Thanks again.

Did you find this page helpful?