Multi-Tenant System In Laravel

text

Multi Tenant System In Laravel

Multi-Tenant System In Laravel

Nowadays most organizations or companies require Software as a Service (SaaS). In SaaS, software is provided on subscription basis where software is being located on external server instead of server located in-house. 

 

In SaaS model users can access programs via the internet instead of each user having to install the software on their own system, A SaaS can run one instance of its application on one instance of database and provide web access (through username and password) to multiple customers. Most of the SaaS products support Multi-Tenant architecture.

 

What is Multi-Tenant

In Multi-Tenant architecture multiple single instances of software run on a single physical server. When customer register for the SaaS, system automatically create new instance for the newly added customer within in a minute. Here tenant is a customer who got instance of our program, now tenant can customize their instance as they want. For example, tenants can change the design of user interface, can customize system meeting their business rules, etc without impacting other customers/tenant.

 

In a multi-tenant architecture, multiple instances of an application operate in a shared environment. This architecture is able to work because each tenant is integrated physically, but logically separated. In other words, a single instance of the software will run on one server and then serve multiple tenants. 

 

To achieve multi-tenancy in Laravel we are using “samuel stancl package”. Using this package we can achieve multi-tenancy in our project with very less and more understandable code. 

 

About Stancl/tenancy

 

This package provides automatic multi-tenancy in application. This means that, in order to implement multi-tenancy using this package, we do not need to change anything in our existing code. This package will create a separate database for each and every customer/tenant and deploy the application separately for each customer. All the tenants are managed by root customer or admin.

 

What would be the DB structure  

 

This package will create 2 tables (domains and tenants) into central database. For tenant database, the migration files will be created which are located in database/migrations/tenant.

Domains Table: This table is used to store domain name, tenant unique id which is also included in the name of tenant database and connected customer id. The domains table is connected with the tenants table using tenant_id column, the tenant_id column is a foreign key for domains table and primary key for the tenants table.

Tenants Table: This table has only 2 fields first is id and second one is data. The data field is used to store all the data about customer in Json format. 

For more information, visit:  https://tenancyforlaravel.com/docs/v3/quickstart  

Defining customer centric solutions for greater business value

Boost your business with our innovative thinking

Sales Department:

  India (HQ)

Address: 422B, Tower B, Ithum, Sector-62, Noida, 201301

Phone:   +91 70119 25215

Email:    surajs@dtechnoland.com

  USA

Address: 2532 Santa Clara Ave, Unit #501, Alameda, CA 94501

Phone: +1 (707) 516-6991

Email:    surajs@dtechnoland.com

  UK

Address: 59, St. Martin’s Lane, Unit #147, London, WC2N 4JS

Phone:  +44 20 3667 9345

Email:    surajs@dtechnoland.com

dreamer logo white

Dreamer Technoland is focused on acting as a “True voice” for our clients by delivering innovative solutions that are designed to meet the business needs.

Follow us on


    You have a vision.
    We have a way to get you there.

    700+

    Projects

    Completed

    8+

    Years of

    Experience

    85%

    Long Term

    Clients





    X
    DOWNLOAD BROCHURE