This package provides full-featured multi-tenancy support for Laravel applications. It allows you to create and manage isolated database schemas or connections per tenant, simplifying the development of SaaS and modular systems.
You can install the package via composer:
composer require mostbyte/multidomainYou can publish and run the migrations with:
php artisan vendor:publish --tag="multidomain-migrations"
php artisan migrateYou can publish the config file with:
php artisan vendor:publish --tag="multidomain-config"This is the contents of the published config file:
return [
];Optionally, you can publish the views using
php artisan vendor:publish --tag="multidomain-views"use Mostbyte\Multidomain\Facades\Multidomain;
Multidomain::setTenant('tenant_1');
// Your tenant-specific logic here- Create a new schema for a tenant:
php artisan schema:migrate schema
- Run migrations for that tenant:
php artisan schema:migrate migrate
- All tenant-specific models and queries will automatically be scoped to the active schema.
composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.