how to share resources on both panels

i have 2 panel, teacher and stundet, i want to create a resource that accessible for both roles, thnaks.
Solution:
Panels need to have their own resource classes. But once you create them, the records of those resources are the same on both panels unless you scope them in some way, like a scope to the logged in user.
Jump to solution
7 Replies
Solution
tuto1902
tuto190216mo ago
Panels need to have their own resource classes. But once you create them, the records of those resources are the same on both panels unless you scope them in some way, like a scope to the logged in user.
MilenKo
MilenKo16mo ago
So having that said, I guess we can use the same models and manipulate the data as required once we have defined the Model to use in every panel? I am asking this as I am in a similar position challenging myself to set two admins (one for "regular user" and one for Admin, but there are things that I would like to overlap as a learning curve to make sure I don't have double data but just use the model to VIEW or Edit depending on the panel type (admin/user).
tuto1902
tuto190216mo ago
A typical example of this: In the Admin panel, the admin user can list, create update and delete records for all students. Let's say for example, that the records in this case are classes. So, the Class model has a resource that the admin can manage. Then, as a student, in the student panel you can have another resource for the Class model but, using scopes, the students can only see classes that are assigned to them, and using policies, you can restrict the resource to be read only. I don't know if that's a good example, but the point is, resources across panels can share the same model but with different access permissions.
MilenKo
MilenKo16mo ago
Yes, it is the perfect example and that is why I sitcked to this plan so I dive in the most complicate scenario I can think of and if I manage to swim out of it, then I've learned a lot and have a working example for a next need 😉 I know most of the smaller projects start simple (single admin and frontend) but since my point is to learn, I need to crack open, digest and know how things work if things are needed to go further (more than a single panel, data sharing, data access restrictions per panel or shared data for several panels). Kudo's @tuto1902 maybe you should share your Buy me a coffee link somewhere so that we have a cup or two shared. Your efforts here - others sell and don't even reply when in need!
tuto1902
tuto190216mo ago
That’s a great attitude and I salute you. 🫡 And I appreciate the kind words. I don’t think this is the place to sell or promote. I’d rather keep this space to help and share 🫶🏻
MilenKo
MilenKo16mo ago
This space no, but maybe add a link in your YouTube so that people know you drink coffee or tea and give the chance to everyone to express their grattitude 🙂
tuto1902
tuto190216mo ago
The link is available in the description of all my YT videos 😉
Want results from more Discord servers?
Add your server