Skip to content

A free open source IT asset/license management system

Fixed more camel-casing -> snake-casing

snipe56576d9e45d8
diff --git a/app/Console/Commands/SyncAssetCounters.php b/app/Console/Commands/SyncAssetCounters.php
index bf63eaff9d..33fee840d6 100644
--- a/app/Console/Commands/SyncAssetCounters.php
+++ b/app/Console/Commands/SyncAssetCounters.php
@@ -39,7 +39,7 @@ class SyncAssetCounters extends Command
public function handle()
{
$start = microtime(true);
- $assets = Asset::withCount('checkins', 'checkouts', 'userRequests')
+ $assets = Asset::withCount('checkins as checkins_count', 'checkouts as checkouts_count', 'userRequests as user_requests_count')
->withTrashed()->get();
if ($assets) {
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php
index 44db9b2035..b8ef8ccda6 100644
--- a/app/Helpers/Helper.php
+++ b/app/Helpers/Helper.php
@@ -281,7 +281,7 @@ class Helper
*/
public static function checkLowInventory()
{
- $consumables = Consumable::withCount('consumableAssignments as consumableAssignments_count')->whereNotNull('min_amt')->get();
+ $consumables = Consumable::withCount('consumableAssignments as consumable_assignments_count')->whereNotNull('min_amt')->get();
$accessories = Accessory::withCount('users as users_count')->whereNotNull('min_amt')->get();
$components = Component::withCount('assets as assets_count')->whereNotNull('min_amt')->get();
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php
index 0ebc4c39e0..320fa9fc19 100644
--- a/app/Http/Controllers/Api/LocationsController.php
+++ b/app/Http/Controllers/Api/LocationsController.php
@@ -41,7 +41,7 @@ class LocationsController extends Controller
'locations.updated_at',
'locations.image',
'locations.currency'
- ])->withCount('assignedAssets as assignedAssets_count')
+ ])->withCount('assignedAssets as assigned_assets_count')
->withCount('assets as assets_count')
->withCount('users as users_count');
@@ -123,7 +123,7 @@ class LocationsController extends Controller
'locations.image',
'locations.currency'
])
- ->withCount('assignedAssets as assignedAssets_count')
+ ->withCount('assignedAssets as assigned_assets_count')
->withCount('assets as assets_count')
->withCount('users as users_count')->findOrFail($id);
return (new LocationsTransformer)->transformLocation($location);
diff --git a/tests/api/ApiLocationsCest.php b/tests/api/ApiLocationsCest.php
index d240cabe1e..76573a35b7 100644
--- a/tests/api/ApiLocationsCest.php
+++ b/tests/api/ApiLocationsCest.php
@@ -32,7 +32,7 @@ class ApiLocationsCest
$response = json_decode($I->grabResponse(), true);
// sample verify
$location = App\Models\Location::orderByDesc('created_at')
- ->withCount('assignedAssets as assignedAssets_count', 'assets as assets_count', 'users as users_count')
+ ->withCount('assignedAssets as assigned_assets_count', 'assets as assets_count', 'users as users_count')
->take(10)->get()->shuffle()->first();
$I->seeResponseContainsJson($I->removeTimestamps((new LocationsTransformer)->transformLocation($location)));
}