Multi tenancy
This application uses https://tenancyforlaravel.com/ for multi-tenancy (a.k.a. multi-company). You can find more information in their documentation.
This means we have 1 shared database (consisting of users, jobs etc.) and a database per tenant.
You can switch between tenants in the top-left side of the header.
Back-end
By default there are 2 tenants that will be seeded by: TenantsTableSeeder
Identifying current tenant
You can get the current active tenant using:
auth()->user()->tenant
Tenancyforlaravel exposes helper methods like tenancy()->init(...)
to execute code specifically for a tenant.
Middleware
In the qore/system/config/qore.php
there is a middleware registered called IdentifyTenant
.
This middleware will initialize tenancy based on the logged in user on each request.
Front-end
The frontend exposes helper methods to each vue component via qore/Mixins/helpers.js
.
You can retrieve the active tenant by call the computed property:
this.$activeTenant