/** * Display the specified user. * * @param int $id * @return Response */ public function show($id) { try { $template = Template::findOrFail($id); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { App::abort(404); } // return $template->layout; return View::make('templates.' . $template->layout, compact('template')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $template = $this->template->findOrFail($id); return View::make('templates.show', compact('template')); }
/** * Update the specified template in storage. * * @param int $id * @return Response */ public function update($id) { $template = Template::findOrFail($id); $validator = Validator::make($data = Input::all(), Template::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } else { } return Redirect::route('templates.index'); }
/** * Remove the specified template from storage. * * @param int $id * @return Response */ public function destroy($id) { $template = Template::findOrFail($id); $file = $template->file; $paths = public_path() . '/uploads/templates/' . $file; File::delete($paths); Template::destroy($id); return Redirect::route('admin.template.index')->with("successMessage", "Template berhasil dihapus. "); }