One of the key things from a SaaS platform, is that it's composed by different "organizations" using the service. By "organization", I mean one user, one company or many users under the roof of a company. It's just an entity that has access to read and create bits of information in the platform.
In very technical terms, this is called a tenant (or support for multitenancy).
Let's quickly list out some basic models:
- A "Company".
- A "Website".
- A "Webinar".
Therefore: A "Company" can have many websites and a "Website" can have many "Webinars".
A common issue when building a SaaS product, is when you retrieve for example, all the "Webinars" for a "Website". In very basic code instructions:
consts domain = getDomain() const website = getWebsiteFrom(domain) const webinars = getWebinarsFrom(website)
Imagine doing all this filtering, everytime you grab information from the database.
So to solve this, there are some good tenant solutions which will avoid this repetition.
I found this great package called Laravel Tenancy. It's easy to install, has good documentation and supports the latest Laravel version.
Also, I created the repo. I'm referring to this project as Gaku (one version of learning in Japanese), but it can change later.
To end this post and based on the tenancy package, I created in the database one instance for a "Hostname" and one instance for a "Website".
Everything works and I get a fresh Laravel instance with tenancy! 🌟
PS: It is also good to mention that I'm using MAMP Pro for setting up an Apache Server and MySQL database.