simplify variables names for templates, refactor to be multi-model
This commit is contained in:
@@ -38,16 +38,17 @@ class MailTemplates
|
||||
|
||||
return [
|
||||
'id' => $id,
|
||||
'users' => $mailable::getUsers(),
|
||||
'list' => $mailable::getContext(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function preview($id, $user_id)
|
||||
public static function preview($id, $model_id)
|
||||
{
|
||||
$template = self::get($id);
|
||||
$mailable = $template->mailable;
|
||||
$data = $mailable::getDataByUser($user_id);
|
||||
$html_template = $template->toArray()['html_template_translations'][$data['lang']] ?? false;
|
||||
$data = $mailable::getData($model_id);
|
||||
|
||||
$html_template = $template->toArray()['html_template_translations'][$data['lang'] ?? 'fr'] ?? false;
|
||||
if ($html_template) {
|
||||
$m = new Mustache_Engine();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user