fix db tables to have school year
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user