/** * @param string $query * @return int */ protected function getRawTotal() { /** * TODO find a less hacky way to do this. */ if ($this->connectionName == 'ott') { $total = User::selectRaw('COUNT(*) AS total')->from(DB::raw(' ( ' . $this->query . ' ) AS t2 '))->setBindings($this->rawQueryBindings)->get(); } else { $total = Customer::selectRaw('COUNT(*) AS total')->from(DB::raw(' ( ' . $this->query . ' ) AS t2 '))->setBindings($this->rawQueryBindings)->get(); } $total = $total->toArray(); $total = $total[0]['total']; return $total; }