/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(ArticleRequest $request, $id) { $article = Article::find($id); //Check fileImage if ($request->hasFile('image')) { $image = $request->file('image'); $imagename = time() . '-' . $image->getClientOriginalName(); $image->move(public_path() . '/image', $imagename); } else { $imagename = $article->image; } //Status if ($request->Input('status') == false) { $status = 0; } else { $status = 1; } //data $data = ['name' => $request->get('name'), 'summary' => $request->get('summary'), 'content' => $request->get('content'), 'image' => $imagename, 'status' => $status]; //update //dd($data); $article->update($data); return redirect()->route('article.index'); }