diff --git a/app/Models/ReportTemplate.php b/app/Models/ReportTemplate.php index c8fcd22742..5c371a82df 100644 --- a/app/Models/ReportTemplate.php +++ b/app/Models/ReportTemplate.php @@ -175,17 +175,17 @@ class ReportTemplate extends Model /** * Get the value of a text field for the given field name. * - * @param string $fieldName + * @param string $fieldName + * @param string|null $fallbackValue * * @return string - * */ - public function textValue(string $fieldName): string + public function textValue(string $fieldName, string|null $fallbackValue = ''): string { // Assuming we're using the null object pattern, // return the default value if the object is not saved yet. if (is_null($this->id)) { - return ''; + return (string) $fallbackValue; } // Return the field's value if it exists diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index 22cec2b322..818a3ef591 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -395,7 +395,7 @@