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:
parent
8b6c88a7c6
commit
fa45ca1453
1 changed files with 5 additions and 0 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue