/** * Save a new classified ad * * @return \Illuminate\Http\RedirectResponse */ public function save() { $classified = new Classified($this->request->all()); $classified->user_id = Auth::check() ? Auth::id() : 0; //$classified->city_id = City::getCityFromAutoComplete($classified->city_id); //todo: change the city choice... $classified->location = $this->_uploadPicture(); $classified->barangay_id = $this->_checkBarangay(); $classified->publish_at = Carbon::now(); $classified->expire_at = Carbon::now()->addMonth('2'); $classified->send_mail = $this->SendMail(); $classified->save(); Email::sendClassifiedCreated($classified); return redirect(route('classified.show', [$classified->city->province->slug, $classified->city->slug, $classified->id]))->with(['success' => 'Your classified add has been created. An email has been send with the details.']); }