How to make one view to display the activities of all tenants in single (possibly different) App. #369
-
I am building a school management application for schools and the Spatie Multi-tenant package has helped make the app tenant aware. Now, I need to create an admin view that shows all schools (tenants), the number of parents in the school, number of students, number of teachers, etc. Can anyone help? Technical Details:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
What are your doubts about it? |
Beta Was this translation helpful? Give feedback.
-
You only need to loop all the tenants with
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much bayangan. This has been very helpful.
…On Sat, Jun 25, 2022 at 5:34 PM bayangan ***@***.***> wrote:
You only need to loop all the tenants with
Tenant::all()->eachCurrent(function($tenant) {
//here $tenant is make current, so the switching db is already done
//you can use query against db to mine data, for eg querying teachers table which exist in tenant db
});
—
Reply to this email directly, view it on GitHub
<#369 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADAPCYGEWWSKKMZJXOC3J43VQ4YHRANCNFSM5YJEZH3A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Thanks, I'll check it out.
…On Mon, Jun 27, 2022, 23:12 Luca Longo ***@***.***> wrote:
IMHO the use of a stats counter is better. Take a look:
https://github.com/spatie/laravel-stats
—
Reply to this email directly, view it on GitHub
<#369 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADAPCYFS2CT5N3RCBLRYZRTVRIROBANCNFSM5YJEZH3A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
You only need to loop all the tenants with