From 5bcbda2f47b12d1a7c9c7b631736f32f23a0fbf0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 2 Jul 2021 07:57:55 +1000 Subject: [PATCH] Minor fixes for document downloads --- app/Http/Middleware/SetDocumentDb.php | 4 ++-- app/Libraries/MultiDB.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/SetDocumentDb.php b/app/Http/Middleware/SetDocumentDb.php index 83d0d0be88..8559c667d9 100644 --- a/app/Http/Middleware/SetDocumentDb.php +++ b/app/Http/Middleware/SetDocumentDb.php @@ -32,9 +32,9 @@ class SetDocumentDb 'errors' => new stdClass, ]; - if ($request->has('document_hash') && config('ninja.db.multi_db_enabled')) { + if (config('ninja.db.multi_db_enabled')) { - if (! MultiDB::documentFindAndSetDb($request->input('document_hash'))) + if (! MultiDB::documentFindAndSetDb($request->segment(2))) return response()->json($error, 400); } diff --git a/app/Libraries/MultiDB.php b/app/Libraries/MultiDB.php index 8120da0892..495b55f97f 100644 --- a/app/Libraries/MultiDB.php +++ b/app/Libraries/MultiDB.php @@ -15,6 +15,7 @@ use App\Models\Client; use App\Models\ClientContact; use App\Models\Company; use App\Models\CompanyToken; +use App\Models\Document; use App\Models\User; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str;