data['title'] = 'Catering'; $this->data['data'] = Catering::find(1); return view('admin.cms.catering', $this->data); } /* | Update catering |-------------------------------------------------------------------------- */ public function updateWebsiteCatering(Request $request) { // dd($request->all()); $update = Catering::find(1); (empty($update)) ? $update = new Catering : ''; $update->c_home_title = $request->c_home_title; $update->c_home_description = $request->c_home_description; $update->c_one_title = $request->c_one_title; $update->c_one_subtitle = $request->c_one_subtitle; $update->c_one_description = $request->c_one_description; $update->c_two_title = $request->c_two_title; $update->c_two_subtitle = $request->c_two_subtitle; $update->c_two_description = $request->c_two_description; $update->c_three_title = $request->c_three_title; $update->c_three_subtitle = $request->c_three_subtitle; $update->c_three_description = $request->c_three_description; $update->c_four_title = $request->c_four_title; $update->c_four_subtitle = $request->c_four_subtitle; $update->c_four_description = $request->c_four_description; if(input::hasfile("c_two_image")){ $image_two_image = $request->file('c_two_image'); $image_c_two_image = time().'.'.$image_two_image->getClientOriginalExtension(); $destinationPath = public_path('/catering'); $image_two_image->move($destinationPath, $image_c_two_image); File::delete(public_path().'/catering/' . $request->old_c_two_image); }else{$image_c_two_image = $request->old_c_two_image;} $update->c_two_image = $image_c_two_image; if(input::hasfile("c_three_image")){ $image_three_image = $request->file('c_three_image'); $image_c_three_image = time().'.'.$image_three_image->getClientOriginalExtension(); $destinationPath = public_path('/catering'); $image_three_image->move($destinationPath, $image_c_three_image); File::delete(public_path().'/catering/' . $request->old_c_three_image); }else{$image_c_three_image = $request->old_c_three_image;} $update->c_three_image = $image_c_three_image; if(input::hasfile("c_four_image")){ $image_four_image = $request->file('c_four_image'); $image_c_four_image = time().'.'.$image_four_image->getClientOriginalExtension(); $destinationPath = public_path('/catering'); $image_four_image->move($destinationPath, $image_c_four_image); File::delete(public_path().'/catering/' . $request->old_c_four_image); }else{$image_c_four_image = $request->old_c_four_image;} $update->c_four_image = $image_c_four_image; $update->save(); $request->session()->flash('message', 'Task was successful!'); return back(); } }