From 781deb25512fbfee8c86ba5175118366f3c118c7 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 20 Nov 2013 04:12:04 -0500 Subject: [PATCH] Added live counts to the top callout boxes --- app/models/Asset.php | 16 ++++++++++++ app/models/License.php | 17 ++++++++++++ app/views/backend/layouts/default.blade.php | 29 ++++++++++++--------- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/app/models/Asset.php b/app/models/Asset.php index 58f3af8a35..685fc2f4a6 100644 --- a/app/models/Asset.php +++ b/app/models/Asset.php @@ -74,6 +74,22 @@ class Asset extends Elegant { return $this->belongsTo('User','id'); } + /** + * Get total assets + */ + public static function assetcount() + { + return Asset::where('physical', '==', 1)->count(); + } + + /** + * Get total assets not checked out + */ + public static function availassetcount() + { + return Asset::where('assigned_to', '==', 0)->count(); + } + } diff --git a/app/models/License.php b/app/models/License.php index ca8f60ee9b..f615c7bd2a 100644 --- a/app/models/License.php +++ b/app/models/License.php @@ -45,5 +45,22 @@ class License extends Elegant { return $this->belongsTo('User','id'); } + /** + * Get total licenses + */ + public static function assetcount() + { + return Asset::where('physical', '==', 1)->count(); + } + + /** + * Get total licenses not checked out + */ + public static function availassetcount() + { + return Asset::where('assigned_to', '==', 0)->count(); + } + + } diff --git a/app/views/backend/layouts/default.blade.php b/app/views/backend/layouts/default.blade.php index c81aecaa4f..b93797707f 100755 --- a/app/views/backend/layouts/default.blade.php +++ b/app/views/backend/layouts/default.blade.php @@ -116,7 +116,11 @@ Admin