Skip to content

A free open source IT asset/license management system

more cleanup to fit formatting convention

Alex Janes08cb8c354b9d
diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php
index 94e9ed9934..cdf885c88b 100644
--- a/app/Http/Controllers/Api/AssetsController.php
+++ b/app/Http/Controllers/Api/AssetsController.php
@@ -856,16 +856,13 @@ class AssetsController extends Controller
}
/**
- * Bulk Checkin an asset
- * This is the current solution to perform a bulk api checkin based on an asset tag, rather than a regular checkin.
- * This is due to the need to find the asset first based on the asset tag.
+ * Checkin an asset by asset tag
*
* @author [A. Janes] [<[email protected]>]
- * @param int $assetId
- * @since [v4.0]
+ * @since [v6.0]
* @return JsonResponse
*/
- public function bulkCheckin(Request $request)
+ public function checkinByTag(Request $request)
{
$this->authorize('checkin', Asset::class);
$asset = Asset::with('assetstatus')->where('asset_tag', $request->input('asset_tag'))->first();
@@ -875,8 +872,8 @@ class AssetsController extends Controller
}
return response()->json(Helper::formatStandardApiResponse('error', [
- 'asset'=> e($request->input('asset_tag'))
- ], 'Asset with tag '.e($request->input('asset_tag')).' not found'));
+ 'asset'=> e($request->input('asset'))
+ ], 'Asset with tag '.e($request->input('asset')).' not found'));
}
diff --git a/resources/views/hardware/quickscan-checkin.blade.php b/resources/views/hardware/quickscan-checkin.blade.php
index 82efcb4dfa..544643e379 100644
--- a/resources/views/hardware/quickscan-checkin.blade.php
+++ b/resources/views/hardware/quickscan-checkin.blade.php
@@ -107,7 +107,7 @@
var formData = $('#checkin-form').serializeArray();
$.ajax({
- url: "{{ route('api.asset.bulkcheckin') }}",
+ url: "{{ route('api.asset.checkinbytag') }}",
type : 'POST',
headers: {
"X-Requested-With": 'XMLHttpRequest',
diff --git a/routes/api.php b/routes/api.php
index 255c6ec17b..f2be014758 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -467,12 +467,12 @@ Route::group(['prefix' => 'v1', 'middleware' => 'api'], function () {
]
)->name('api.asset.checkin');
- Route::post('bulkcheckin',
- [
- Api\AssetsController::class,
- 'bulkcheckin'
- ]
- )->name('api.asset.bulkcheckin');
+ Route::post('checkinbytag',
+ [
+ Api\AssetsController::class,
+ 'checkinbytag'
+ ]
+ )->name('api.asset.checkinbytag');
Route::post('checkout',
[