From a17b82bdde2d1b61d6780ef0c33d071bbf0daba6 Mon Sep 17 00:00:00 2001
From: Dan Brown <ssddanbrown@googlemail.com>
Date: Sat, 25 Apr 2020 21:37:52 +0100
Subject: [PATCH] Fixed api query total not taking filters into account

---
 app/Api/ListingResponseBuilder.php | 3 ++-
 app/Config/snappy.php              | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/Api/ListingResponseBuilder.php b/app/Api/ListingResponseBuilder.php
index 942c5d270..5245a5d90 100644
--- a/app/Api/ListingResponseBuilder.php
+++ b/app/Api/ListingResponseBuilder.php
@@ -36,6 +36,8 @@ class ListingResponseBuilder
      */
     public function toResponse()
     {
+        $this->applyFiltering($this->query);
+
         $total = $this->query->count();
         $data = $this->fetchData();
 
@@ -52,7 +54,6 @@ class ListingResponseBuilder
     {
         $this->applyCountAndOffset($this->query);
         $this->applySorting($this->query);
-        $this->applyFiltering($this->query);
 
         return $this->query->get($this->fields);
     }
diff --git a/app/Config/snappy.php b/app/Config/snappy.php
index 60c26ffd5..f347eda23 100644
--- a/app/Config/snappy.php
+++ b/app/Config/snappy.php
@@ -13,7 +13,9 @@ return [
         'enabled' => true,
         'binary'  => file_exists(base_path('wkhtmltopdf')) ? base_path('wkhtmltopdf') : env('WKHTMLTOPDF', false),
         'timeout' => false,
-        'options' => [],
+        'options' => [
+            'outline' => true
+        ],
         'env'     => [],
     ],
     'image' => [