sadeghpm / xshop-multitenancy
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sadeghpm/xshop-multitenancy
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! ❤️