/**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     // $input = Input::except('_token', '_method');
     $inputSlide = Input::except('_token', 'image_url');
     CommonNormal::update($id, $inputSlide);
     $imageSlide = AdminSlide::find($id);
     $input['image_url'] = CommonUpload::uploadImage($id, UPLOADIMG, 'image_url', UPLOAD_SLIDE, $imageSlide->image_url);
     CommonNormal::update($id, ['image_url' => $input['image_url']]);
     return Redirect::action('AdminSlideController@index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $rules = array('title' => 'required', 'type_id' => 'required', 'position' => 'integer|min:1', 'weight' => 'integer|min:1');
     $input = Input::except('_token');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::action('AdminAboutUsController@edit', $id)->withErrors($validator)->withInput(Input::except('title'));
     } else {
         $inputNews = Input::only('type_id', 'title', 'description', 'weight');
         $relateUpdateId = Common::getValueLanguage('AboutUs', $id, 'relate_id');
         $inputUpdateRelate['title'] = $input['en_title'];
         $inputUpdateRelate['description'] = $input['en_description'];
         $inputUpdateRelate['type_id'] = Common::getValueLanguage('TypeAboutUs', Input::get('type_id'), 'relate_id');
         CommonNormal::update($id, $inputNews);
         CommonNormal::update($relateUpdateId, $inputUpdateRelate);
         // $inputLanguage = Input::only('position');
         //AdminLanguage::where('model_name', 'AboutUs')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage);
         //update upload image
         $imageAbout = AboutUs::find($id);
         $input['image_url'] = CommonUpload::uploadImage($id, UPLOADIMG, 'image_url', UPLOAD_ABOUT, $imageAbout->image_url);
         CommonNormal::update($id, ['image_url' => $input['image_url']]);
         CommonNormal::update($relateUpdateId, ['image_url' => $input['image_url']]);
     }
     return Redirect::action('AdminAboutUsController@index');
 }
Example #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     if (!Admin::isSeo()) {
         $rules = array('name' => 'required');
         $input = Input::except('_token');
         $validator = Validator::make($input, $rules);
         if ($validator->fails()) {
             return Redirect::action('NewsController@edit', $id)->withErrors($validator)->withInput(Input::except('name'));
         } else {
             $inputNews = Input::only('type_new_id', 'name', 'description');
             $relateUpdateId = Common::getValueLanguage('AdminNew', $id, 'relate_id');
             $inputUpdateRelate['name'] = $input['en_name'];
             $inputUpdateRelate['description'] = $input['en_description'];
             $inputUpdateRelate['type_new_id'] = Common::getValueLanguage('TypeNew', Input::get('type_new_id'), 'relate_id');
             CommonNormal::update($id, $inputNews);
             CommonNormal::update($relateUpdateId, $inputUpdateRelate);
             $inputLanguage = Input::only('position', 'status');
             AdminLanguage::where('model_name', 'AdminNew')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage);
             //update upload image
             $imageNews = AdminNew::find($id);
             $input['image_url'] = CommonUpload::uploadImage($id, UPLOADIMG, 'image_url', UPLOAD_NEWS, $imageNews->image_url);
             CommonNormal::update($id, ['image_url' => $input['image_url']]);
             CommonNormal::update($relateUpdateId, ['image_url' => $input['image_url']]);
         }
     }
     return Redirect::action('NewsController@index');
 }
 public function imageProduct()
 {
     $input = Input::all();
     return CommonUpload::commonUploadImage($input, PRODUCT_UPLOAD, 1);
 }