Skip to content

Instantly share code, notes, and snippets.

@AhmedHelalAhmed
Created February 6, 2019 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AhmedHelalAhmed/31d5bc0efd42f5afe3766c90785c4ee8 to your computer and use it in GitHub Desktop.
Save AhmedHelalAhmed/31d5bc0efd42f5afe3766c90785c4ee8 to your computer and use it in GitHub Desktop.
multi-tenant commands
composer require hyn/multi-tenant ~5.1
@AhmedHelalAhmed
Copy link
Author

in config/database.php change mysql to system
Now open your .env

DB_CONNECTION=system
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=townhousedb
DB_USERNAME=townhouseadmin
DB_PASSWORD=secret

@AhmedHelalAhmed
Copy link
Author

Because we are using MySQL, we need to limit UUID length generated by the multi-tenant package to under 32 characters and this can be set by using an environment variable LIMIT_UUID_LENGTH_32. Set it to true in your .env file:

LIMIT_UUID_LENGTH_32=true

@AhmedHelalAhmed
Copy link
Author

move your migrations into
database/migrations/tenant
if you want to make it for each tenant
php artisan tenancy:install

@AhmedHelalAhmed
Copy link
Author

AhmedHelalAhmed commented Feb 6, 2019

https://laravel-tenancy.com/docs/hyn/5.1/installation
php artisan vendor:publish --tag=tenancy
https://laravel-news.com/laravel-5-4-key-too-long-error
php artisan migrate --database=system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment