Skip to content

A free open source IT asset/license management system

Added assets relationship

snipeeb5d93b3c2bf
diff --git a/app/Models/Depreciation.php b/app/Models/Depreciation.php
index 9faa1b86e2..7aceddf7c4 100755
--- a/app/Models/Depreciation.php
+++ b/app/Models/Depreciation.php
@@ -75,4 +75,17 @@ class Depreciation extends SnipeModel
{
return $this->hasMany(\App\Models\License::class, 'depreciation_id');
}
+
+ /**
+ * Establishes the depreciation -> assets relationship
+ *
+ * @author A. Gianotto <[email protected]>
+ * @since [v5.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function assets()
+ {
+ return $this->hasManyThrough(\App\Models\Asset::class, \App\Models\AssetModel::class, 'depreciation_id', 'model_id');
+ }
+
}