diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 06edd36b8d5..ef302a7d3bb 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -1384,21 +1384,23 @@ class="table table-striped snipe-table" - @can('view', $asset->model) -
-
-
- - - -
-
-
- @endcan + @if ($asset->model) + @can('view', $asset->model) +
+
+
+ + + +
+
+
+ @endcan + @endif @@ -1420,4 +1422,4 @@ class="table table-striped snipe-table" @include ('partials.bootstrap-table') -@stop \ No newline at end of file +@stop diff --git a/tests/Feature/Assets/Ui/ShowAssetTest.php b/tests/Feature/Assets/Ui/ShowAssetTest.php new file mode 100644 index 00000000000..23b6c8f31e6 --- /dev/null +++ b/tests/Feature/Assets/Ui/ShowAssetTest.php @@ -0,0 +1,26 @@ +create(); + + $asset->model_id = null; + $asset->forceSave(); + + $asset->refresh(); + + $this->assertNull($asset->fresh()->model_id, 'This test needs model_id to be null to be helpful.'); + + $this->actingAs(User::factory()->superuser()->create()) + ->get(route('hardware.show', $asset)) + ->assertOk(); + } +}