Properly scope archived based on settings

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-06-18 10:27:11 +01:00
parent 0b30ad0da2
commit 941582ac2a
2 changed files with 3 additions and 3 deletions

View file

@ -288,7 +288,7 @@ class AssetModelsController extends Controller
public function show($modelId = null)
{
$this->authorize('view', AssetModel::class);
$model = AssetModel::withTrashed()->withCount('assets')->find($modelId);
$model = AssetModel::withTrashed()->find($modelId);
if (isset($model->id)) {
return view('models/view', compact('model'));

View file

@ -42,8 +42,8 @@
<i class="fas fa-barcode fa-2x"></i>
</span>
<span class="hidden-xs hidden-sm">
{{ trans('general.assets') }}
{!! ($model->assets_count > 0 ) ? '<badge class="badge badge-secondary">'.number_format($model->assets_count).'</badge>' : '' !!}
{{ trans('general.assets') }}
{!! ($model->assets()->AssetsForShow()->count() > 0 ) ? '<badge class="badge badge-secondary">'.number_format($model->assets()->AssetsForShow()->count()).'</badge>' : '' !!}
</span>
</a>
</li>