Skip to content

A free open source IT asset/license management system

Added audits method

snipe31c9ffa32bda
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index a0e1132793..7fd80eaf01 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -690,6 +690,21 @@ class Asset extends Depreciable
->withTrashed();
}
+
+ /**
+ * Get the list of audits for this asset
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v2.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function audits()
+ {
+ return $this->assetlog()->where('action_type', '=', 'audit')
+ ->orderBy('created_at', 'desc')
+ ->withTrashed();
+ }
+
/**
* Get the list of checkins for this asset
*