added more eager loading
This commit is contained in:
parent
e273c7cbc5
commit
bfd827e529
1 changed files with 12 additions and 1 deletions
|
@ -491,7 +491,18 @@ class AssetsController extends Controller
|
||||||
public function showBySerial(Request $request, $serial): JsonResponse | array
|
public function showBySerial(Request $request, $serial): JsonResponse | array
|
||||||
{
|
{
|
||||||
$this->authorize('index', Asset::class);
|
$this->authorize('index', Asset::class);
|
||||||
$assets = Asset::where('serial', $serial)->with('assetstatus')->with('assignedTo');
|
$assets = Asset::where('serial', $serial)->with([
|
||||||
|
'assetstatus',
|
||||||
|
'assignedTo',
|
||||||
|
'company',
|
||||||
|
'defaultLoc',
|
||||||
|
'location',
|
||||||
|
'model.category',
|
||||||
|
'model.depreciation',
|
||||||
|
'model.fieldset',
|
||||||
|
'model.manufacturer',
|
||||||
|
'supplier',
|
||||||
|
]);
|
||||||
|
|
||||||
// Check if they've passed ?deleted=true
|
// Check if they've passed ?deleted=true
|
||||||
if ($request->input('deleted', 'false') == 'true') {
|
if ($request->input('deleted', 'false') == 'true') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue