Add helper for listing file + db templates
This commit is contained in:
parent
90d2b87180
commit
942a8c000e
|
|
@ -45,6 +45,23 @@ class MailTemplate extends Model
|
|||
|
||||
protected static $registeredTemplates;
|
||||
|
||||
/**
|
||||
* Returns an array of template codes and descriptions.
|
||||
* @return array
|
||||
*/
|
||||
public static function listAllTemplates()
|
||||
{
|
||||
$fileTemplates = (array) self::make()->listRegisteredTemplates();
|
||||
$dbTemplates = (array) self::lists('description', 'code');
|
||||
$templates = $fileTemplates + $dbTemplates;
|
||||
ksort($templates);
|
||||
return $templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Syncronise all file templates to the database.
|
||||
* @return void
|
||||
*/
|
||||
public static function syncAll()
|
||||
{
|
||||
$templates = self::make()->listRegisteredTemplates();
|
||||
|
|
|
|||
Loading…
Reference in New Issue