/** * Display a specified ad. * * @param int $id * @return Response */ public function show($zip) { try { $geoService = new SoapClient(Config::get('wsdl.utility'), array()); $result = $geoService->getAddressByZipcode(array("zipcode" => $zip)); return get_object_vars($result); } catch (Exception $ex) { throw new Exception($ex->getMessage()); } }
/** * Update profile * * @return Response */ public function updateProfile() { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user'), array()); $geoService = new SoapClient(Config::get('wsdl.utility'), array()); $currentUser = $userService->getUserByEmail(array('email' => $session['data']->email))->user; $currentUser->businessName = Input::get('businessName'); $currentUser->about = Input::get('about'); $currentUser->address = $geoService->getAddressByZipcode(array("zipcode" => Input::get('zipCode')))->address; $currentUser->website = Input::get('website'); $currentUser->contactName = Input::get('contactName'); $currentUser->contactNumber = Input::get('contactNumber'); $currentUser->email = Input::get('email'); try { $userService->updateUser(array('user' => $currentUser)); } catch (Exception $ex) { } }
/** * Update profile * * @return Response */ public function updateProfile() { $session = Session::get('user'); $userService = new SoapClient(Config::get('wsdl.user'), array()); $geoService = new SoapClient(Config::get('wsdl.utility'), array()); $currentUser = $userService->getUserByEmail(array('email' => $session['data']->email))->user; if (!$currentUser->address) { $address = new Address(); } else { $address = new Address($currentUser->address); } $currentUser->firstName = Input::get('first_name'); $currentUser->lastName = Input::get('last_name'); $currentUser->about = Input::get('about'); if (Input::get('zipCode')) { $address = $geoService->getAddressByZipcode(array("zipcode" => Input::get('zipCode'))); $currentUser->address = $address->address; } else { if (Input::get('zipCode') == "") { $currentUser->address = new Address(); } } try { $userService->updateUser(array('user' => $currentUser)); } catch (Exception $ex) { } }