tyn's avatar
Level 6

Best approach to loading custom classes in multi-tenant application

Hello folks. What is the best approach to loading custom classes in a multi-tenant application? Each tenant might need a set of customizable business logic, customizable user registration section injected into the registration process, and a couple of forms with different upload requirements.

For example, Tenant A will require their clients to fill out a form with three questions and upload a proof of insurance file. Tenant B requires the client to fill a different form with two different questions and no uploads, while Tenant C just requires a number of files to be uploaded based on some dynamic criteria.

We are toying with multi-database architecture as well as a single-database approaches. Currently evaluating the https://github.com/stancl/tenancy (docs - https://tenancy.samuelstancl.me/docs/v2) and https://github.com/kristijanhusak/laravel-form-builder to build forms from an array. Is it possible and proper to define custom form arrays as JSON in the DB/file and business logic in service classes and models for the tenants under storage/app/{tenant-id}/resources and then load them into the app through a service provider? Or is there a different and perhaps simpler approach to all this?

Thank you in advance for your time and responses.

0 likes
1 reply
peter.keri's avatar

Dear Tyn,

i have the same problem. Did you find any solution for this issue? Thanks for reply, best regards, Peter

Please or to participate in this conversation.