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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners