Skip to content

Commit bfd827e

Browse files
committed
added more eager loading
1 parent e273c7c commit bfd827e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

app/Http/Controllers/Api/AssetsController.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,18 @@ public function showByTag(Request $request, $tag): JsonResponse | array
491491
public function showBySerial(Request $request, $serial): JsonResponse | array
492492
{
493493
$this->authorize('index', Asset::class);
494-
$assets = Asset::where('serial', $serial)->with('assetstatus')->with('assignedTo');
494+
$assets = Asset::where('serial', $serial)->with([
495+
'assetstatus',
496+
'assignedTo',
497+
'company',
498+
'defaultLoc',
499+
'location',
500+
'model.category',
501+
'model.depreciation',
502+
'model.fieldset',
503+
'model.manufacturer',
504+
'supplier',
505+
]);
495506

496507
// Check if they've passed ?deleted=true
497508
if ($request->input('deleted', 'false') == 'true') {

0 commit comments

Comments
 (0)