Merge pull request #11417 from ntbutler-nbcs/master

[Feature] - Add checkoutByTag API endpoint for assets
This commit is contained in:
snipe
2022-06-29 05:03:01 -07:00
committed by GitHub
3 changed files with 27 additions and 6 deletions
+15 -1
View File
@@ -746,7 +746,21 @@ class AssetsController extends Controller
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 200);
}
/**
* Checkout an asset by its tag.
*
* @author [N. Butler]
* @param string $tag
* @since [v6.0.5]
* @return JsonResponse
*/
public function checkoutByTag(AssetCheckoutRequest $request, $tag)
{
if ($asset = Asset::where('asset_tag', $tag)->first()) {
return $this->checkout($request, $asset->id);
}
return response()->json(Helper::formatStandardApiResponse('error', null, 'Asset not found'), 200);
}
/**
* Checkout an asset