Category: Laravel

Recently I started to rebuild an ten-ish year old SaaS product in Laravel from an abandoned framework. The product needs multi tenancy with separate databases for each tenant.

The package provides an artisan command to run other artisan commands for each tenant in the application, for example to migrate each tenant: This command will loop through each tenant, sets the tenant as the current one and then performs the artisan command.

This is the full handle method: First we check if “currentTenant” is in available in the service container.

Now that everything is in place we can set the maintenance mode for a specific tenant like this: That’s all there is to add the possibility to set the maintenance mode for a specific tenant, while keeping the option to set the maintenance mode globally.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners