My boilerplate for multi-tenancy websites using Laravel 5.7 and Hyn/Tenancy 5.3. Highly based on the tutorial by Ashok Gelal (https://blog.usejournal.com/writing-a-full-featured-multi-tenant-laravel-app-from-scratch-a0e1a7350d9d, I've kept the name Townhouse to honor him) and on the collective work you can find on Discord's Tenancy server
Thanks for the updated boilerplate code. I've been trying to follow the tutorial while using your updated code as I go along. Things seem to be working up to the point where I create a tenant for the first time.
I have copied your code for the User, Role, and Permission models as well as your TenantDatabaseSeeder. When I run php artisan tenant:create it processes everything up to the point of assigning the admin role to the tenant and throws this error:
$ php artisan tenant:create
Provide information to create new tenant.
Please enter tenant name:
> boise
You do want to redirect this tenant? (yes/no) [no]:
> no
You do want to force https? (yes/no) [no]:
> no
Is tenant under maintenance? (yes/no) [no]:
> no
Please enter administrator name:
> boise
Please enter administrator email:
> boise@example.com
Tenant information
------------
Tenant FQDN: boise.localhost
Administrator name: boise
Administrator email: boise@example.com
Do you want to create a tenant with this data? (yes/no) [no]:
> yes
Creating tenant, please wait...
1/2 [==============>-------------] 50%
In RoleDoesNotExist.php line 11:
There is no role named `admin`.
checking mysql, I see a new database created, with the appropriate tables with the exception there are no roles added to the roles table:
I've been asking around in Discord and have yet to figure out what is causing the problem. Does anyone have a solution?
Quick update here, it seems that my config was cached using the old settings. I ran a quick php artisan config:clear and have successfully created my first tenant! Thanks to @Waiel
Thanks for the updated boilerplate code. I've been trying to follow the tutorial while using your updated code as I go along. Things seem to be working up to the point where I create a tenant for the first time.
I have copied your code for the User, Role, and Permission models as well as your TenantDatabaseSeeder. When I run
php artisan tenant:create
it processes everything up to the point of assigning the admin role to the tenant and throws this error:checking mysql, I see a new database created, with the appropriate tables with the exception there are no roles added to the roles table:
I've been asking around in Discord and have yet to figure out what is causing the problem. Does anyone have a solution?
Thanks!