diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php index 5ac958a8ac..012f40e399 100755 --- a/app/Http/Controllers/AssetModelsController.php +++ b/app/Http/Controllers/AssetModelsController.php @@ -288,7 +288,7 @@ class AssetModelsController extends Controller public function show($modelId = null) { $this->authorize('view', AssetModel::class); - $model = AssetModel::withTrashed()->find($modelId); + $model = AssetModel::withTrashed()->withCount('assets')->find($modelId); if (isset($model->id)) { return view('models/view', compact('model')); diff --git a/resources/views/models/view.blade.php b/resources/views/models/view.blade.php index 29cfd99c11..a98e14b4ee 100755 --- a/resources/views/models/view.blade.php +++ b/resources/views/models/view.blade.php @@ -43,7 +43,7 @@
@@ -342,7 +342,7 @@ @endcan @can('delete', \App\Models\AssetModel::class) - @if ($model->assets->count() > 0) + @if ($model->assets_count > 0)