A free open source IT asset/license management system
Added helper method for uploads
snipe3d3a4b02fc4e
diff --git a/app/Models/Component.php b/app/Models/Component.phpindex 79d2fe55f2..dc353d288c 100644--- a/app/Models/Component.php+++ b/app/Models/Component.php@@ -88,6 +88,24 @@ class Component extends SnipeModel'location' => ['name'],];++ /**+ * Establishes the components -> action logs -> uploads relationship+ *+ * @author A. Gianotto <[email protected]>+ * @since [v6.1.13]+ * @return \Illuminate\Database\Eloquent\Relations\Relation+ */+ public function uploads()+ {+ return $this->hasMany(\App\Models\Actionlog::class, 'item_id')+ ->where('item_type', '=', self::class)+ ->where('action_type', '=', 'uploaded')+ ->whereNotNull('filename')+ ->orderBy('created_at', 'desc');+ }++/*** Establishes the component -> location relationship*