-
Notifications
You must be signed in to change notification settings - Fork 475
Description
For example:
You have a UserService where you call withDepth() function and before that line of code is reached, your model user model gobal scope join is added to query. Then there is an error that coulmn xy is not found in table users.
UserModel:
$query->join('user_relation_clients', function ($join) use ($currentClientId) { $join->on('users.id', '=', 'user_relation_clients.user_id') ->where('user_relation_clients.client_id', $currentClientId); });
UserService:
$user->withDepth()->having('depth', '=', $this->request->get('depth'));
Error:
select *, (select count(1) - 1 from usersas_dinner joinuser_relation_clientsonusers.id=user_relation_clients.user_idanduser_relation_clients.auth_client_id= 2ea431c9-5218-4a96-89d2-587e441725ba whereusers._lftbetween_d._lftand_d._rgt) as depthfromusersinner joinuser_relation_clientsonusers.id=user_relation_clients.user_idanduser_relation_clients.auth_client_id= 2ea431c9-5218-4a96-89d2-587e441725ba whereis_published= 1 andusers._lftbetween 38 and 54 havingdepth= 1 order byorder_no asc
@lazychaser is there any workaround ?