Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
799c9c910e
1 changed files with 2 additions and 15 deletions
|
@ -417,21 +417,8 @@ class AssetsController extends Controller
|
||||||
$assets = $assets->withTrashed();
|
$assets = $assets->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
$assets = $assets->get();
|
|
||||||
|
|
||||||
if (($assets = $assets->get()) && ($assets->count()) > 0) {
|
if (($assets = $assets->get()) && ($assets->count()) > 0) {
|
||||||
|
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
|
||||||
// If there is exactly one result and the deleted parameter is not passed, we should pull the first (and only)
|
|
||||||
// asset from the returned collection, since transformAsset() expects an Asset object, NOT a collection
|
|
||||||
if (($assets->count() == 1) && ($request->input('deleted') != 'true')) {
|
|
||||||
return (new AssetsTransformer)->transformAsset($assets->first());
|
|
||||||
|
|
||||||
// If there is more than one result OR if the endpoint is requesting deleted items (even if there is only one
|
|
||||||
// match, return the normal collection transformed.
|
|
||||||
} else {
|
|
||||||
return (new AssetsTransformer)->transformAssets($assets, $assets->count());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are 0 results, return the "no such asset" response
|
// If there are 0 results, return the "no such asset" response
|
||||||
|
|
Loading…
Add table
Reference in a new issue