Laravel Multi tenancy

Viewed 848

In my laravel project I am using multi tenancy. For project related work I am creating a laravel custom artisan command. I am trying to connect with repository model in that artisan command that I am creating. But I could not connect with the database. It says

Database [tenant] not configured.

How to use multi tenancy in my custom artisan command. So that I can use all the needed repository models in custom artisan command. Please suggest.

1 Answers

I assume you are using: hyn/multi-tenant

To run specific commands you could use the tenancy:run command. Lets say you have a command sync:donuts, which needs to be run on tenant id=1.

Then you should use:

php artisan tenancy:run sync:donuts --tenant=1

Read more in the documentation

Related