Files
2026-05-16 13:44:12 -04:00

18 lines
544 B
PHP
Executable File

<?php
namespace App\Models;
use CodeIgniter\Model;
class EmailTemplateModel extends Model {
protected $table = 'email_templates';
protected $primaryKey = 'id';
protected $allowedFields = ['template_key','name','subject','body','is_active'];
public function getActiveTemplates(): array {
return $this->where('is_active', 1)->orderBy('template_key','asc')->findAll();
}
public function findByKey(string $key): ?array {
return $this->where('template_key', $key)->where('is_active', 1)->first();
}
}