/** * Update an existing ad * * @param $id * * @return \Illuminate\Http\RedirectResponse */ public function store($id) { $classified = Classified::whereId($id)->first(); Helper::allow('classified-edit', $classified); $classified = new Classified($this->request->all()); $classified->city_id = City::getCityFromAutoComplete($classified->city_id); if ($location = $this->_uploadPicture()) { $classified->location = $location; } $classified->barangay_id = $this->_checkBarangay(); $classified->send_mail = $this->SendMail(); $classified->whereId($id)->update($classified->toArray()); return redirect(route('classified.show', [$classified->city->province->slug, $classified->city->slug, $id]))->with(['success' => 'Your classified add has been updated']); }