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(); } } }
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(); }