Merge pull request #12763 from inietov/fixes/call_to_member_function_licenses_on_null

Fixed Call to a Member Function Licenses() on null [sc-20606]
This commit is contained in:
snipe 2023-03-30 14:20:13 -07:00 committed by GitHub
commit cfef9d8cca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -463,7 +463,7 @@ class AssetsController extends Controller
{
$this->authorize('view', Asset::class);
$this->authorize('view', License::class);
$asset = Asset::where('id', $id)->withTrashed()->first();
$asset = Asset::where('id', $id)->withTrashed()->firstorfail();
$licenses = $asset->licenses()->get();
return (new LicensesTransformer())->transformLicenses($licenses, $licenses->count());