18 lines
544 B
PHP
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();
|
|
}
|
|
}
|