activa Posted June 29, 2017 Report Share Posted June 29, 2017 What is the best and correct query to get all services that use the package X . Basing in the package_group_id return incorrect data for some packages . Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted June 29, 2017 Report Share Posted June 29, 2017 9 hours ago, activa said: What is the best and correct query to get all services that use the package X . Basing in the package_group_id return incorrect data for some packages . take this, i use it and i can get the total services using the package X with option to filter per service status public function getUsedServices($package_id, $service_status = null) { $this->Record->select('services.id')->from('package_pricing')-> innerJoin('services', 'services.pricing_id', '=', 'package_pricing.id', false)-> where('package_pricing.package_id', '=', $package_id); if ($service_status) { $this->Record->where('services.status', '=', $service_status); } return $this->Record->numResults(); } you can use it as getUsedServices($package_id, 'active') to get total active services using the package X activa and Beav 2 Quote Link to comment Share on other sites More sharing options...
activa Posted July 4, 2017 Author Report Share Posted July 4, 2017 Work as i want . Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.