Skip to content

Commit 23b54de

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 3934b40 + bd742ae commit 23b54de

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

app/Http/Controllers/ViewAssetsController.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,19 @@ public function getIndex(Request $request) : View | RedirectResponse
156156
public function getRequestableIndex() : View
157157
{
158158
$assets = Asset::with('model', 'defaultLoc', 'location', 'assignedTo', 'requests')->Hardware()->RequestableAssets();
159-
$models = AssetModel::with('category', 'requests', 'assets')->RequestableModels()->get();
159+
$models = AssetModel::with([
160+
'category',
161+
'requests',
162+
'assets' => function ($q) {
163+
$q->where('requestable', 1)
164+
->whereHas('assetstatus', fn ($s) =>
165+
$s->where('archived', 0)
166+
->where(fn ($s) =>
167+
$s->where('deployable', 1)->orWhere('pending', 1)
168+
)
169+
);
170+
},
171+
])->RequestableModels()->get();
160172

161173
return view('account/requestable-assets', compact('assets', 'models'));
162174
}

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)