/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $image = array(); $project = ProjectGalleries::where('id', '=', $id)->update(['title' => $request->get('title'), 'content' => $request->get('content'), 'date' => $request->get('date')]); $image = Input::file('image'); if (is_null($image)) { } else { foreach ($image as $value) { $filename = "MEI" . str_random(5) . "-" . $value->getClientOriginalName(); $project_image = new ProjectImage(array('image' => $filename, 'project_galleries_id' => $id)); $project_image->save(); $value->move(base_path() . '/public/admin/gallery/', $filename); } } Session::flash('flash_message', 'Project Updated!'); return redirect()->back(); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function getProject($id) { $project_gallery = ProjectGalleries::where('id', $id)->with('projectimages')->get(); return view('recent-projects', [$id], compact('project_gallery')); }