sadeghpm / xshop-multitenancy
There is no license information available for the latest version (v1.0) of this package.
v1.0
2024-11-25 07:19 UTC
Requires
README
xShop Multitenancy Package
Note
This package provides multitenancy support for xShop, facilitating the management of multiple tenant databases.
New Features
- Database creation for each tenant.
- Tenant-specific migrations and seeders.
- Automatic admin user creation for tenants.
Installation
To install the package, follow these steps:
composer require sadeghpm/xshop-multitenancy
Multitenancy Setup
Initial Setup
Run the multitenancy:setup command to configure multitenancy:
php artisan multitenancy:setup
Change Database config
Add the following line to your config/database.php
file:
'landlord'=>[ 'driver' => 'sqlite', 'database' => database_path('tenant-db.sqlite'), 'prefix' => '', ], 'tenant'=>[ 'driver' => 'sqlite', 'database' => null, 'prefix' => '', ],
Set active connection to tenant in .env
file:
DB_CONNECTION=tenant
Adding Tenants
To add new tenants, use the multitenancy:create-tenant command:
php artisan multitenancy:create-tenant
This command will:
- Ask for the tenant's name and domain.
- Create the tenant in the database.
- Prompt for admin user details and create the admin user for the new tenant.
Commands Summary
multitenancy:setup
: For initial configuration and creating the first tenant.multitenancy:create-tenant
: For adding new tenants.multitenancy:list-tenants
: To list all tenants.
Developed With Love! ❤️