From 31c9ffa32bdae752bd18080fa32ea2622357d8f6 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 8 Apr 2025 05:08:42 +0100 Subject: [PATCH] Added audits method Signed-off-by: snipe --- app/Models/Asset.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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] [] + * @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 *