Eager load asset query on maintenances to prevent n+1 queries

This commit is contained in:
snipe 2016-08-11 15:56:21 -07:00
parent 7992258b46
commit 3a81b7e612

View file

@ -309,7 +309,7 @@ class AssetMaintenancesController extends Controller
'' => 'Select an improvement type',
] + AssetMaintenance::getImprovementOptions();
$assets = Company::scopeCompanyables(Asset::all(), 'assets.company_id')->lists('detailed_name', 'id');
$assets = Company::scopeCompanyables(Asset::with('model','assignedUser')->get(), 'assets.company_id')->lists('detailed_name', 'id');
// Get Supplier List
$supplier_list = Helper::suppliersList();