Skip to content

A free open source IT asset/license management system

Merge branch 'fix-factory-auto-gen-action-logs' into add_types_to_unaccepted_asset_report

Godfrey Mfea018947942
diff --cc app/Models/Consumable.php
index 27b7a5581f,806b10d317..ed40ffc3de
--- a/app/Models/Consumable.php
+++ b/app/Models/Consumable.php
@@@ -312,21 -312,10 +312,24 @@@ class Consumable extends SnipeMode
return $remaining;
}
+ public function totalCostSum() {
+ return $this->purchase_cost !== null ? $this->qty * $this->purchase_cost : null;
+ }
+ /**
+ * Get the list of checkouts for this consumable
+ *
+ * @author [A. Gianotto] [<[email protected]>]
+ * @since [v2.0]
+ * @return \Illuminate\Database\Eloquent\Relations\Relation
+ */
+ public function checkouts()
+ {
+ return $this->assetlog()->where('action_type', '=', 'checkout')
+ ->orderBy('created_at', 'desc')
+ ->withTrashed();
+ }
+
/**
* -----------------------------------------------
* BEGIN MUTATORS