Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
cb8a212d96
1 changed files with 5 additions and 0 deletions
|
@ -75,6 +75,11 @@ class AssetModelFilesController extends Controller
|
||||||
*/
|
*/
|
||||||
public function list($assetmodel_id) : JsonResponse | array
|
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);
|
$assetmodel = AssetModel::with('uploads')->find($assetmodel_id);
|
||||||
$this->authorize('view', $assetmodel);
|
$this->authorize('view', $assetmodel);
|
||||||
return (new AssetModelsTransformer)->transformAssetModelFiles($assetmodel, $assetmodel->uploads()->count());
|
return (new AssetModelsTransformer)->transformAssetModelFiles($assetmodel, $assetmodel->uploads()->count());
|
||||||
|
|
Loading…
Add table
Reference in a new issue