/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['formats' => 'required_if:type,0,1,2', 'start_date' => 'required|date', 'end_date' => 'required|date|after:start_date', 'url' => 'required_if:type,3']);
     $model = LaunchRes::find($id);
     if ($model == null) {
         return view('errors.404');
     }
     $model->url = $request->input('url');
     $model->start_date = $request->input('start_date');
     $model->end_date = $request->input('end_date');
     $model->active = $request->input('active') ? 1 : 0;
     if ($model->type == 3) {
         //home page html
         $model->format = '';
         $model->ext = 'html';
         $model->num = count(explode(';', $request->input('url')));
         $model->save();
         $ver = ResourceVer::where('resource_name', 'homepage')->first();
         if ($ver != null) {
             $ver->ver = time();
             $ver->save();
         }
     } else {
         $relativePathPrefix = Utils::getLaunchImgPath($model->type);
         $model->img = $relativePathPrefix;
         try {
             Common::handleFormats($request, $model, $relativePathPrefix);
         } catch (FunFangException $e) {
             return $this->getCreateView()->withErrors($e->getMessage());
         }
         $model->save();
         $ver = ResourceVer::where('resource_name', 'launch_ver')->first();
         if ($ver != null) {
             $ver->ver = time();
             $ver->save();
         }
     }
     return Redirect::to('res/launch');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['formats' => 'required', 'title' => 'required', 'sub_cat_id' => 'required|integer']);
     $model = PropertyCustomize::find($id);
     if ($model == null) {
         return view('errors.404');
     }
     $subCatId = $request->input('sub_cat_id');
     $relativePathPrefix = Utils::getPropCustImgPath($subCatId);
     $model->listingID = $request->input('listingID');
     $model->title = $request->input('title');
     $model->lat = $request->input('lat');
     $model->lng = $request->input('lng');
     $model->address = $request->input('address');
     $model->city = $request->input('city');
     $model->state = $request->input('state');
     $model->zipcode = $request->input('zipcode');
     $model->img = $relativePathPrefix;
     try {
         Common::handleFormats($request, $model, $relativePathPrefix);
     } catch (FunFangException $e) {
         return $this->getCreateView()->withErrors($e->getMessage());
     }
     $model->save();
     return $this->toListView();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['formats' => 'required', 'start_date' => 'required|date', 'end_date' => 'required|date|after:start_date']);
     $relativePathPrefix = 'images/banner_' . time();
     $model = BannerRes::findOrFail($id);
     $model->url = $request->input('url');
     $model->start_date = $request->input('start_date');
     $model->end_date = $request->input('end_date');
     $model->active = $request->input('active') ? 1 : 0;
     $model->img = $relativePathPrefix;
     try {
         Common::handleFormats($request, $model, $relativePathPrefix);
     } catch (FunFangException $e) {
         return $this->getCreateView()->withErrors($e->getMessage());
     }
     $model->save();
     $ver = ResourceVer::where('resource_name', 'banner_ver')->first();
     if ($ver != null) {
         $ver->ver = time();
         $ver->save();
     }
     return Redirect::to('res/banner');
 }