A free open source IT asset/license management system
Added uploads method
snipe00092a079fcf
diff --git a/app/Models/Location.php b/app/Models/Location.phpindex 69c79cfaeb..9b1ed02f43 100755--- a/app/Models/Location.php+++ b/app/Models/Location.php@@ -20,6 +20,7 @@ class Location extends SnipeModel{use HasFactory;use CompanyableTrait;+ use Loggable;protected $presenter = \App\Presenters\LocationPresenter::class;use Presentable;@@ -288,6 +289,23 @@ class Location extends SnipeModelreturn $this->attributes['ldap_ou'] = empty($ldap_ou) ? null : $ldap_ou;}+ /**+ * Get uploads for this location+ *+ * @author [A. Gianotto] [<[email protected]>]+ * @since [v4.0]+ * @return \Illuminate\Database\Eloquent\Relations\Relation+ */+ public function uploads()+ {+ return $this->hasMany('\App\Models\Actionlog', 'item_id')+ ->where('item_type', '=', Location::class)+ ->where('action_type', '=', 'uploaded')+ ->whereNotNull('filename')+ ->orderBy('created_at', 'desc');+ }++/*** Query builder scope to order on parent*