fix db tables to have school year

This commit is contained in:
root
2026-07-12 01:02:04 -04:00
parent ed11cccecc
commit ec9fca8c45
42 changed files with 988 additions and 195 deletions
+10 -3
View File
@@ -6,12 +6,19 @@ use CodeIgniter\Model;
class EmailTemplateModel extends Model {
protected $table = 'email_templates';
protected $primaryKey = 'id';
protected $allowedFields = ['template_key','name','subject','body','is_active'];
protected $allowedFields = ['code', 'variant', 'subject', 'body_html', 'is_active', 'updated_by', 'updated_at'];
public function getActiveTemplates(): array {
return $this->where('is_active', 1)->orderBy('template_key','asc')->findAll();
return $this->select('email_templates.*, code AS template_key, code AS name, body_html AS body')
->where('is_active', 1)
->orderBy('code', 'asc')
->findAll();
}
public function findByKey(string $key): ?array {
return $this->where('template_key', $key)->where('is_active', 1)->first();
return $this->select('email_templates.*, code AS template_key, code AS name, body_html AS body')
->where('code', $key)
->where('is_active', 1)
->first();
}
}