/** * Update the specified article in storage. * * @param int $id * @return Response */ public function update($id) { $article = Article::findOrFail($id); $validator = Validator::make($data = Input::all(), Article::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $article->update($data); return Redirect::route('admin.articles.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { try { $article = Article::findOrFail($id); $article->delete(); return Response::make(['status' => 'deleted'], 204); } catch (ModelNotFoundException $e) { Log::error($e->getTraceAsString()); return Response::make(['status' => 'error'], 404); } }
public function show($id) { //return $id; $article = Article::findOrFail($id); return view('articles.show', compact('article')); }