Mailables::getList(), ]; } public static function edit($id) { $data = self::get($id)->toArray(); $mailable = $data['mailable']; $data['vars'] = $mailable::getVariables(); return $data; } public static function getVarsByMailable($mailable) { return $mailable::getVariables(); } public static function getDataFormodalPreview($id) { $template = self::get($id); $mailable = $template->mailable; return [ 'id' => $id, 'users' => $mailable::getUsers(), ]; } public static function preview($id, $user_id) { $template = self::get($id); $mailable = $template->mailable; $data = $mailable::getDataByUser($user_id); $html_template = $template->toArray()['html_template_translations'][$data['lang']] ?? false; if ($html_template) { $m = new Mustache_Engine(); return $m->render($html_template, $data); } else { return false; } } public static function getModel() { return MailTemplate::query(); } }