Reputation: 484
I use spatie laravel multi tenancy.
https://spatie.be/docs/laravel-multitenancy/v1/installation/using-multiple-databases
I want to do a simple query with query builder.
DB:table('users')->select('username')->get(); // i would like use this
But use wrong database homestead
. If I use the model it works fine.
User::select('username')->get();
How can I solve this problem?
Upvotes: 0
Views: 838
Reputation: 76
using the DB Facade you should specify the connection name like so:
DB::connection('tenant')->table('users')->....
Upvotes: 3