/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $this->validate($request, ['nama_download' => 'required|max:200']); $down = Download::findOrFail($id); $data['nama_download'] = $request->nama_download; if ($request->hasFile('image')) { $data['file_download'] = $this->savePhoto($request->file('image')); } if ($down->update($data)) { \Flash::success('Download Berhasil Diupdate'); } else { \Flash::info('Download Gagal Diupdate'); } return redirect('admin/download'); }