public function update(Request $request, $id)
 {
     $rules = ['contents' => 'required'];
     $this->validate($request, $rules);
     $origin = Origin::find($id);
     $origin->save();
     return redirect()->route('admin.origin.show', ['id' => $id]);
 }
 private function _get($api_url, $pg)
 {
     //return;
     $json = json_decode(file_get_contents($api_url . '&page=' . $pg), true);
     $result = $json['result'];
     $totalPage = ceil($result['totalCount'] / 10);
     $site = $result['site'];
     $list = $site['list'];
     foreach ($list as $key => $value) {
         $n_id = $value['id'];
         $n_name = $value['name'];
         $n_tel = $value['tel'];
         $n_category = json_encode($value['category']);
         $n_address = $value['address'];
         $n_roadAddress = $value['roadAddress'];
         $n_abbrAddress = $value['abbrAddress'];
         $n_display = $value['display'];
         $n_telDisplay = $value['telDisplay'];
         $n_ktCallMd = $value['ktCallMd'];
         $n_coupon = $value['coupon'];
         $n_thumUrl = $value['thumUrl'];
         $n_type = $value['type'];
         $n_posExact = $value['posExact'];
         $n_x = $value['x'];
         $n_y = $value['y'];
         $n_homePage = $value['homePage'];
         $n_couponUrl = $value['couponUrl'];
         $n_couponUrlMobile = $value['couponUrlMobile'];
         $n_hasCardBenefit = $value['hasCardBenefit'];
         $n_menuExist = $value['menuExist'];
         $origin = Origin::where('n_id', $n_id)->first();
         if (empty($origin->id)) {
             $code = preg_replace('/[^0-9]*/s', '', $n_id);
             $html = new Htmldom('http://map.naver.com/local/siteview.nhn?code=' . $code);
             $keywords = $this->_keywords($html->find('.item_keyword'));
             $times = json_encode($this->_times($html->find('.section_detail_time')));
             $infos = $this->_infos($html->find('.section_detail_info'));
             $pays = json_encode($this->_pays($html->find('.section_detail_pay')));
             $detail = $this->_detail($html->find('.section_detail'));
             $intro = $this->_intro($html->find('.map_intro'));
             $images = json_encode($this->_images($html->find('ul[id=_thumbImgList]')));
             $origin = new Origin();
             $origin->n_id = $n_id;
             $origin->n_name = $n_name;
             $origin->n_tel = $n_tel;
             $origin->n_category = $n_category;
             $origin->n_address = $n_address;
             $origin->n_roadAddress = $n_roadAddress;
             $origin->n_abbrAddress = $n_abbrAddress;
             $origin->n_display = $n_display;
             $origin->n_telDisplay = $n_telDisplay;
             $origin->n_ktCallMd = $n_ktCallMd;
             $origin->n_coupon = $n_coupon;
             $origin->n_thumUrl = $n_thumUrl;
             $origin->n_type = $n_type;
             $origin->n_posExact = $n_posExact;
             $origin->n_x = $n_x;
             $origin->n_y = $n_y;
             $origin->n_homePage = $n_homePage;
             $origin->n_couponUrl = $n_couponUrl;
             $origin->n_couponUrlMobile = $n_couponUrlMobile;
             $origin->n_hasCardBenefit = $n_hasCardBenefit;
             $origin->n_menuExist = $n_menuExist;
             $origin->n_keyword = implode(',', $keywords);
             $origin->n_time = $times;
             $origin->n_info = implode(',', $infos);
             $origin->n_pay = $pays;
             $origin->n_detail = $detail;
             $origin->n_way = $intro;
             $origin->n_photo = $images;
             $origin->save();
             echo '.';
         } else {
             echo 'x';
         }
     }
     if ($pg < $totalPage) {
         $next = $pg + 1;
         $this->_get($api_url, $next);
     }
 }