From 7352eaec2ea6f69dda021b549e1f77ba001bd4b5 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 19 Nov 2013 17:32:33 -0500 Subject: [PATCH] Helper methods for license view display --- app/models/License.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/models/License.php b/app/models/License.php index 134ee1a5df..fcad687647 100644 --- a/app/models/License.php +++ b/app/models/License.php @@ -21,6 +21,29 @@ class License extends Elegant { return $this->belongsTo('User', 'assigned_to'); } + /** + * Get the asset's location based on the assigned user + **/ + public function assetloc() + { + return $this->assigneduser->hasOne('Location'); + } + + /** + * Get action logs for this asset + */ + public function assetlog() + { + return $this->hasMany('Actionlog','asset_id')->orderBy('added_on', 'desc'); + } + + /** + * Get action logs for this asset + */ + public function adminuser() + { + return $this->belongsTo('User','id'); + } }