public static function addNew($data) { $template = new MailingTemplate(); $template->name = $data['name']; $template->content = $data['content']; $template->save(); return $template; }
public function doEditTemplate(Request $request) { $template = MailingTemplate::findOrFail($request->input('template_id')); $template->name = $request->input('name'); $template->content = $request->input('content'); if ($request->hasFile('thumbnail')) { $template->addThumbnail($request->file('thumbnail')); } $template->save(); return redirect()->to('marketing/templates')->with('template-edited', true); }