public function run()
 {
     //
     // @todo
     //
     // Add a Welcome template or something
     //
     Template::create(['title' => 'Demo Template', 'slug' => 'demo-template', 'lang' => 'en', 'autoresponse' => 1, 'content' => "Hello {{ sender_name }},\r\n" . "An user sent you a message from website.\r\n" . "Name: {{ name }}\r\n" . "Email: {{ email }}\r\n" . "Phone: {{ phone }}\r\n" . "Message: \r\n\n{{ body|raw }}\r\n", 'content_html' => "<p>Hello {{ sender_name }},</p>\r\n" . "<p>An user sent you a message from website.</p>\r\n" . "Name: {{ name }}<br />\r\n" . "Email: {{ email }}<br />\r\n" . "Phone: {{ phone }}\r\n" . "<p>Message:</p> {{ body|raw }}\r\n", 'fields' => 'name|required,email|required|email,phone,body|required', 'sender_name' => 'Your Name', 'sender_email' => '*****@*****.**', 'subject' => 'Demo Template :: {{ subject }}', 'confirmation_text' => 'Thank you! Your message has been successfully received, we\'ll return the contact soon.']);
 }
Exemple #2
0
 public function up()
 {
     $templates = DB::table('octodevel_octomail_templates')->where('filename', 'like', '%view-%')->get();
     if ($templates) {
         foreach ($templates as $template) {
             $filename = str_replace('view-', '', $template->filename);
             $temp_mail = Template::find($template->id);
             $temp_mail->filename = $filename;
             $temp_mail->save();
         }
     }
 }
Exemple #3
0
 public function index_onDuplicate()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $itemId) {
             if (!($item = Template::find($itemId))) {
                 continue;
             }
             $data = $item->attributes;
             if (!$data) {
                 throw new \Exception(sprintf(Lang::get('octodevel.octomail::lang.controllers.templates.functions.index_onDuplicate.no_data_error')));
             }
             // Insert data
             $newItem = Template::find($itemId)->replicate()->beforeDuplicate();
         }
         Flash::success(Lang::get('octodevel.octomail::lang.controllers.templates.functions.index_onDuplicate.success'));
     }
     return $this->listRefresh();
 }
Exemple #4
0
 protected function loadTemplate()
 {
     $id = $this->property('templateName');
     if (is_numeric($id)) {
         return TemplateBase::getTemplate()->where('id', '=', $id)->first();
     }
     return TemplateBase::getTemplate()->where('slug', '=', $id)->first();
 }
Exemple #5
0
 protected function loadTemplate($id = '')
 {
     return Template::getTemplate()->where('id', '=', $id)->first();
 }