public function upload(StoreIssuePostRequest $request) { try { $city = $this->city->firstOrCreate(['name' => Input::get('city')]); $issue = new Issue(); $issue->city_id = $city->id; $issue->email = Input::get('email'); $issue->comment = Input::get('comment'); $issue->username = Input::get('username'); $issue->status_id = Status::$OPEN; $issue->facebook_id = Input::get('facebook_id'); $issue->category_id = Input::get('category_id'); $lonlat = Input::get('lonlat'); $issue->geom = DB::raw("ST_GeomFromText('POINT({$lonlat})', 4326)"); $issue->image_path = $issue->upload(Input::file('file')); return $issue->save() ? 'Parabéns! Problema reportado.' : 'Ops, saiu algo errado... x_x'; } catch (Exception $e) { return $e->getMessage(); } }