Merge pull request #12943 from marcusmoore/fixes/avoid-loading-unused-models-for-report

Remove the loading of asset maintenances that are not used by view
This commit is contained in:
snipe 2023-05-03 10:41:52 -07:00 committed by GitHub
commit 914b2658cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View file

@ -36,7 +36,7 @@ class AssetMaintenancesController extends Controller
{ {
$this->authorize('view', Asset::class); $this->authorize('view', Asset::class);
$maintenances = AssetMaintenance::select('asset_maintenances.*')->with('asset', 'asset.model', 'asset.location', 'supplier', 'asset.company', 'admin'); $maintenances = AssetMaintenance::select('asset_maintenances.*')->with('asset', 'asset.model', 'asset.location', 'asset.defaultLoc', 'supplier', 'asset.company', 'admin');
if ($request->filled('search')) { if ($request->filled('search')) {
$maintenances = $maintenances->TextSearch($request->input('search')); $maintenances = $maintenances->TextSearch($request->input('search'));

View file

@ -898,12 +898,8 @@ class ReportsController extends Controller
public function getAssetMaintenancesReport() public function getAssetMaintenancesReport()
{ {
$this->authorize('reports.view'); $this->authorize('reports.view');
// Grab all the improvements
$assetMaintenances = AssetMaintenance::with('asset', 'supplier', 'asset.company')
->orderBy('created_at', 'DESC')
->get();
return view('reports/asset_maintenances', compact('assetMaintenances')); return view('reports.asset_maintenances');
} }
/** /**