mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Use firstorfail on eloquent query to return error if asset is not found
This commit is contained in:
parent
c9d1274edc
commit
d10b7fd6af
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue