fix logic and tests, update docker CI file

This commit is contained in:
root
2026-03-09 15:58:44 -04:00
parent 1cb3573d4b
commit 79e44fe037
188 changed files with 1776 additions and 524 deletions
+6 -4
View File
@@ -30,7 +30,7 @@ class AttendanceEmailTemplate extends BaseModel
* Fetch a template by code and variant, falling back to 'default' if needed.
* Active only.
*/
public static function getTemplate(string $code, string $variant = 'default'): ?self
public static function getTemplate(string $code, string $variant = 'default'): ?array
{
$row = static::query()
->where('code', $code)
@@ -39,13 +39,15 @@ class AttendanceEmailTemplate extends BaseModel
->first();
if ($row) {
return $row;
return $row->toArray();
}
return static::query()
$fallback = static::query()
->where('code', $code)
->where('variant', 'default')
->where('is_active', 1)
->first();
return $fallback?->toArray();
}
}
}