[英]Laravel Multi tenancy
In my laravel project I am using multi tenancy.在我的 Laravel 项目中,我使用了多租户。 For project related work I am creating a laravel custom artisan command.
对于项目相关的工作,我正在创建一个 laravel 自定义 artisan 命令。 I am trying to connect with repository model in that artisan command that I am creating.
我正在尝试在我正在创建的那个 artisan 命令中连接存储库模型。 But I could not connect with the database.
但是我无法连接到数据库。 It says
它说
Database [tenant] not configured.未配置数据库 [租户]。
How to use multi tenancy in my custom artisan command.如何在我的自定义 artisan 命令中使用多租户。 So that I can use all the needed repository models in custom artisan command.
这样我就可以在自定义 artisan 命令中使用所有需要的存储库模型。 Please suggest.
请建议。
I assume you are using: hyn/multi-tenant
我假设您正在使用:
hyn/multi-tenant
To run specific commands you could use the tenancy:run
command.要运行特定命令,您可以使用
tenancy:run
命令。 Lets say you have a command sync:donuts
, which needs to be run on tenant id=1.假设您有一个命令
sync:donuts
,它需要在租户 id=1 上运行。
Then you should use:那么你应该使用:
php artisan tenancy:run sync:donuts --tenant=1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.