public function doDelete() { $id_page = Input::get("id"); if ($id_page) { $page = EmailsTemplate::find($id_page)->delete(); } return Response::json(array('status' => 'ok')); }
public function __construct($slug, $params) { if ($slug && $params) { $result = EmailsTemplate::where("slug", $slug)->first(); foreach ($params as $k => $el) { $search[] = "{" . $k . "}"; $replace[] = $el; } $search[] = "{domen}"; $replace[] = $_SERVER['HTTP_HOST']; if ($result->id) { $this->subject = $result->subject; $this->body = $result->body; $this->body = str_replace('/images/', 'http://' . Request::server("HTTP_HOST") . "/images/", $this->body); $this->body = str_replace($search, $replace, $this->body); $this->subject = str_replace($search, $replace, $this->subject); } } }