A free open source IT asset/license management system
Add docblocks
Marcus Mooreb74115b60469
diff --git a/app/Models/ReportTemplate.php b/app/Models/ReportTemplate.phpindex 6c8aa622fa..5eed35b705 100644--- a/app/Models/ReportTemplate.php+++ b/app/Models/ReportTemplate.php@@ -43,11 +43,24 @@ class ReportTemplate extends Model});}+ /**+ * Establishes the report template -> creator relationship.+ *+ * @since [v6.2.4]+ */public function user(): BelongsTo{return $this->belongsTo(User::class);}+ /**+ * Get the value of a checkbox field for the given field name.+ *+ * @param string $fieldName+ * @param string $fallbackValue The value to return if the report template is not saved yet.+ *+ * @since [v6.2.4]+ */public function checkmarkValue(string $fieldName, string $fallbackValue = '1'): string{// Assuming we're using the null object pattern, and an empty model@@ -62,6 +75,15 @@ class ReportTemplate extends Modelreturn $this->options[$fieldName] ?? '0';}+ /**+ * Get the value of a radio field for the given field name.+ *+ * @param string $fieldName+ * @param string $value The value to check against.+ * @param bool $isDefault Whether the radio input being checked is the default.+ *+ * @since [v6.2.4]+ */public function radioValue(string $fieldName, string $value, bool $isDefault = false): bool{$fieldExists = array_has($this->options, $fieldName);@@ -81,6 +103,16 @@ class ReportTemplate extends Modelreturn false;}+ /**+ * Get the value of a select field for the given field name.+ *+ * @param string $fieldName+ * @param string|null $model The Eloquent model to check against.+ *+ * @return mixed|null+ *+ * @since [v6.2.4]+ */public function selectValue(string $fieldName, string $model = null){// If the field does not exist then return null.@@ -109,6 +141,16 @@ class ReportTemplate extends Modelreturn $value;}+ /**+ * Get the values of a multi-select field for the given field name.+ *+ * @param string $fieldName+ * @param string|null $model The Eloquent model to check against.+ *+ * @return iterable+ *+ * @since [v6.2.4]+ */public function selectValues(string $fieldName, string $model = null): iterable{// If the field does not exist then return an empty array.@@ -132,6 +174,15 @@ class ReportTemplate extends Modelreturn $this->options[$fieldName];}+ /**+ * Get the value of a text field for the given field name.+ *+ * @param string $fieldName+ *+ * @return string+ *+ * @since [v6.2.4]+ */public function textValue(string $fieldName): string{// Assuming we're using the null object pattern,diff --git a/app/Models/User.php b/app/Models/User.phpindex 8355189b14..e81be484f3 100644--- a/app/Models/User.php+++ b/app/Models/User.php@@ -330,6 +330,11 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCoreturn $this->belongsToMany(\App\Models\License::class, 'license_seats', 'assigned_to', 'license_id')->withPivot('id');}+ /**+ * Establishes the user -> reportTemplates relationship+ *+ * @since [v6.2.4]+ */public function reportTemplates(): HasMany{return $this->hasMany(ReportTemplate::class);