includeUnitsWithoutFormation : false; // Check if model has a direct unit column $unitColumn = property_exists($this, 'unitColumn') ? $this->unitColumn : 'unit_id'; // Check if model has an indirect unit relationship $unitRelationship = property_exists($this, 'unitRelationship') ? $this->unitRelationship : null; if ($unitRelationship) { return $this->getVisibilityService()->applyVisibilityToIndirectQuery( $query, $user, $unitRelationship, $includeUnitsWithoutFormation ); } return $this->getVisibilityService()->applyVisibilityToQuery( $query, $user, $unitColumn, $includeUnitsWithoutFormation ); } /** * Get all units under the same government as the user's unit * Handles both direct government relationships and formation-government relationships * Priority: Direct government_id takes precedence over formation government * * @deprecated Use VisibilityService::getUnitsUnderGovernment() instead */ protected function getUnitsUnderGovernment($userUnit) { return $this->getVisibilityService()->getUnitsUnderGovernment($userUnit); } }