From 97a05e01b2a44fdbae1901b82d98e8f231927323 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 Nov 2013 15:54:30 -0500 Subject: [PATCH] reintroducing eloquent/fluent check --- src/Bllim/Datatables/Datatables.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Bllim/Datatables/Datatables.php b/src/Bllim/Datatables/Datatables.php index 75d0fdfa..e63050b8 100644 --- a/src/Bllim/Datatables/Datatables.php +++ b/src/Bllim/Datatables/Datatables.php @@ -476,9 +476,12 @@ public function database_prefix() { private function count($count = 'count_all') { + //Get columns to temp var. + $query_type = get_class($this->query) == 'Illuminate\Database\Query\Builder' ? 'fluent' : 'eloquent'; + $query = $query_type == 'eloquent' ? $this->query->getQuery() : $this->query; //Count the number of rows in the select - $this->$count = DB::table(DB::raw('('.$this->query->toSql().') AS count_row_table')) - ->setBindings($this->query->getBindings())->count(); + $this->$count = DB::table(DB::raw('('.$query->toSql().') AS count_row_table')) + ->setBindings($query->getBindings())->count(); }