An application for several clients with Laravel [closed]

2

I'm creating a project for a web application for multiple clients using Laravel . In my project this application would have several databases, one for each client. Searching the internet, I saw that over time it would be complicated to maintain, for several issues like: maintenance, backups and etc ... considering this would be better to create an application with a single database and relating these tables? Our greatest fear is that there is a mixture of these data in the application. Could someone give us a light ...?

    
asked by anonymous 08.12.2015 / 14:36

2 answers

3

If you are going to keep the same tables for customers, or the same basis, you do not have to do this. Just do a 1 to 1 relationship in each table with a user table that the data would not mix (it is premise the database does not allow this, but of course it needs the developer collaboration), since each data belongs to a single customer.

Study the 1 to 1 relationship in the databases just as Laravel works with them through the following link: link

[edit] I had not read the other answer when I started this, but that's exactly what it says, one answer complements the other. ;)

    
08.12.2015 / 16:10
4

For your solution you could search on multi-tenancy architecture.

I've been looking for multi-tenancy in Laravel and unfortunately have not found much (pre-ready).

Basically you create a Tenancy table (renters or user, for example) and in ALL the tables you determine who is the owner of that data.

In every query you will have to add the tenant_id of the logged in user.

I did not find any interesting link in the stack overflow in Portuguese, so I'll leave this iMasters link for you link .

@edit The template you are looking for is called Software as a Service (SaaS).

    
08.12.2015 / 15:47