From 1453b364848597f02bf53e9e21ee6b66aef0d4ea Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Wed, 18 May 2022 14:46:48 -0500 Subject: [PATCH] Add filter to only get Assets for the unaccepted assets report --- app/Http/Controllers/ReportsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 3c27f386c..bcd43e51b 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -939,9 +939,9 @@ class ReportsController extends Controller * Get all assets with pending checkout acceptances */ if($showDeleted) { - $acceptances = CheckoutAcceptance::pending()->withTrashed()->with(['assignedTo' , 'checkoutable.assignedTo', 'checkoutable.model'])->get(); + $acceptances = CheckoutAcceptance::pending()->where('checkoutable_type', 'App\Models\Asset')->withTrashed()->with(['assignedTo' , 'checkoutable.assignedTo', 'checkoutable.model'])->get(); } else { - $acceptances = CheckoutAcceptance::pending()->with(['assignedTo' => function ($query) { + $acceptances = CheckoutAcceptance::pending()->where('checkoutable_type', 'App\Models\Asset')->with(['assignedTo' => function ($query) { $query->withTrashed(); }, 'checkoutable.assignedTo', 'checkoutable.model'])->get(); }