mirror of
https://github.com/snipe/snipe-it.git
synced 2026-02-07 13:45:43 +00:00
Stupid fix for when people use id instead of an actual ID
@todo - use RMB for these Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
@ -75,6 +75,11 @@ class AssetModelFilesController extends Controller
|
||||
*/
|
||||
public function list($assetmodel_id) : JsonResponse | array
|
||||
{
|
||||
// Start by checking if the asset being acted upon exists
|
||||
if (! $assetModel = AssetModel::find($assetmodel_id)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404);
|
||||
}
|
||||
|
||||
$assetmodel = AssetModel::with('uploads')->find($assetmodel_id);
|
||||
$this->authorize('view', $assetmodel);
|
||||
return (new AssetModelsTransformer)->transformAssetModelFiles($assetmodel, $assetmodel->uploads()->count());
|
||||
|
||||
Reference in New Issue
Block a user