Files
alrahma_sunday_school/app/Models/EmailTemplateModel.php
T
2026-02-10 22:11:06 -05:00

18 lines
544 B
PHP

<?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();
}
}