Laravel

Sync data between central application and tenant application in tenancyforlaravel package

I recently watch the course about multi-tenancy multi database course in codecourse that uses tenancyforlaravel package, and I have a case for the subscription purpose that I need to check tenant's database from the central database and central database from tenant's database using this package, so is there a way to do that?

In the central database I have a plan table which holds each plans table like 'storage_usage, user_limit, record_limit' and each tenant have a specific plan type

So in my central database I need to check 'user, some other tables' to know the usage of each tenant from the admin dashboard

And same from tenant's database to check plan detail to let the user do the specific action or not, if you say just store the plan detail in each tenant's database I can't because the plan may change and I need to check it

Thanks for answering!

shadyar
shadyar
1
6
132
alex
alex
Moderator

I haven't worked with this package for a little while, but I think what you may need is syncing resources.

Take a look and let me know if you think this might solve your problem. If not, I'll do some more digging :)

https://tenancyforlaravel.com/docs/v3/synced-resources-between-tenants

shadyar
shadyar

Thank you very much, I'll try to do it, if it doesn't work out I'll tell you

Thanks!

farishrf
farishrf

Hey Alex, I've got a question or perhaps an idea,

How can we handle the storage_usage, user_limit, record_limit that @shadyar mentioned.. Like after payment will we copy these again into a different table (it will feel messy) ? how can you deal if a staff change these constraints, perhaps a versioning system for each plan (legally better) ? etc.. Could be an interesting idea to go through these in a video.

Sorry for interrupting.

alex
alex
Moderator

No worries @farishrf, this sounds like something I could cover in a course. I'm due to update the multi-tenancy series anyway.

farishrf
farishrf

Thanks Alex. Just as a side note if you are going to use archtechx tenancy package, I'd suggest you to wait for the Version 4 release before updating the series. I've been playing around with it, a lot of bugs fixed only in V4.

alex
alex
Moderator

Thanks for the heads up!