Skip to content

A free open source IT asset/license management system

Use statics for location, supplier, etc

snipe1c1729854e79
diff --git a/app/Http/Transformers/ActionlogsTransformer.php b/app/Http/Transformers/ActionlogsTransformer.php
index 51274a4d5a..e760ba351a 100644
--- a/app/Http/Transformers/ActionlogsTransformer.php
+++ b/app/Http/Transformers/ActionlogsTransformer.php
@@ -52,7 +52,7 @@ class ActionlogsTransformer
static $custom_fields = false;
if ($custom_fields === false) {
- $custom_fields = CustomField::all();
+ $custom_fields = CustomField::all();
}
if ($actionlog->filename!='') {
@@ -221,12 +221,29 @@ class ActionlogsTransformer
*/
public function changedInfo(array $clean_meta)
- { $location = Location::withTrashed()->get();
- $supplier = Supplier::withTrashed()->get();
- $model = AssetModel::withTrashed()->get();
- $status = Statuslabel::withTrashed()->get();
- $company = Company::get();
+ {
+ static $location = false;
+ static $supplier = false;
+ static $model = false;
+ static $status = false;
+ static $company = false;
+
+ if ($location === false) {
+ $location = Location::select('id', 'name')->withTrashed()->get();
+ }
+ if ($supplier === false) {
+ $supplier = Supplier::select('id', 'name')->withTrashed()->get();
+ }
+ if ($model === false) {
+ $model = AssetModel::select('id', 'name')->withTrashed()->get();
+ }
+ if ($status === false) {
+ $status = Statuslabel::select('id', 'name')->withTrashed()->get();
+ }
+ if ($company === false) {
+ $company = Company::select('id', 'name')->get();
+ }
if(array_key_exists('rtd_location_id',$clean_meta)) {