diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 5f010bdbb7..d78a2074f9 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -899,8 +899,8 @@ class AssetsController extends Controller if ($request->filled('location_id')) { $asset->location_id = $request->input('location_id'); - if ($request->get('update_default_location') == 0){ - $asset->rtd_location_id = $request->get('location_id'); + if ($request->input('update_default_location')){ + $asset->rtd_location_id = $request->input('location_id'); } } diff --git a/tests/Feature/Api/Assets/AssetCheckinTest.php b/tests/Feature/Api/Assets/AssetCheckinTest.php index 060d0aacd1..27d5e6de80 100644 --- a/tests/Feature/Api/Assets/AssetCheckinTest.php +++ b/tests/Feature/Api/Assets/AssetCheckinTest.php @@ -103,7 +103,7 @@ class AssetCheckinTest extends TestCase $this->actingAsForApi(User::factory()->checkinAssets()->create()) ->postJson(route('api.asset.checkin', $asset), [ 'location_id' => $location->id, - 'update_default_location' => 0 + 'update_default_location' => true, ]); $this->assertTrue($asset->refresh()->defaultLoc()->is($location));