/**
  * 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('description' => 'required');
     $input = Input::except('_token');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::action('AdminContactController@edit', $id)->withErrors($validator);
     } else {
         $inputUpdateMain = Input::only('description', 'lat', 'long');
         $relateUpdateId = Common::getValueLanguage('Contact', $id, 'relate_id');
         $inputUpdateRelate['description'] = $input['en_description'];
         $inputUpdateRelate['lat'] = $input['lat'];
         $inputUpdateRelate['long'] = $input['long'];
         CommonNormal::update($id, $inputUpdateMain);
         CommonNormal::update($relateUpdateId, $inputUpdateRelate);
         $inputLanguage = Input::only('status');
         AdminLanguage::where('model_name', 'Contact')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage);
         return Redirect::action('AdminContactController@edit', $id);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     CommonNormal::delete($id);
     return Redirect::action('FeedbackController@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');
 }
Beispiel #5
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 refuse($id)
 {
     CommonNormal::update($id, ['status' => REFUSE, 'start_time' => Carbon\Carbon::now()]);
     return Redirect::action('ProductController@index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $input = Input::all();
     $viInput['title'] = $input['title'];
     $viInput['description'] = $input['description'];
     $viInput['css'] = $input['css'];
     $viInput['position'] = $input['position'];
     CommonNormal::update($id, $viInput);
     $enInput['title'] = $input['en_title'];
     $enInput['description'] = $input['en_description'];
     $enInput['css'] = $input['css'];
     $enInput['position'] = $input['position'];
     $en = AdminLanguage::where('model_name', 'Introduce')->where('model_id', $id)->first();
     if ($en) {
         $idEn = $en->relate_id;
         CommonNormal::update($idEn, $enInput);
     }
     return Redirect::action('AdminIntroduceController@index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $rules = array('name' => 'required', 'position' => 'required|integer|min: 1');
     $input = Input::except('_token');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::action('NewsTypeController@edit', $id)->withErrors($validator);
     } else {
         $inputUpdateMain = Input::only('name', 'position');
         $relateUpdateId = Common::getValueLanguage('TypeNew', $id, 'relate_id');
         $inputUpdateRelate['name'] = $input['en_name'];
         $inputUpdateRelate['position'] = $input['position'];
         CommonNormal::update($id, $inputUpdateMain);
         CommonNormal::update($relateUpdateId, $inputUpdateRelate);
         $inputLanguage = Input::only('position', 'status');
         AdminLanguage::where('model_name', 'TypeNew')->where('model_id', $id)->where('relate_id', $relateUpdateId)->update($inputLanguage);
         return Redirect::action('NewsTypeController@index');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $data = Category::find($id);
     if ($data) {
         RelationBox::deleteRelationship($data, 'prices');
         CommonNormal::delete($id);
         return Redirect::action('CategoryController@index')->with('message', 'Đã xóa');
     }
     return Redirect::action('CategoryController@index')->with('message', 'Không tồn tại');
 }
 public function updatePassword($id)
 {
     $rules = array('password' => 'required', 'repassword' => 'required|same:password');
     $input = Input::except('_token');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::action('ManagerController@changePassword', $id)->withErrors($validator)->withInput(Input::except('password'));
     } else {
         $inputPass['password'] = Hash::make($input['password']);
         CommonNormal::update($id, $inputPass);
     }
     return Redirect::action('ManagerController@changePassword', $id)->with('message', 'Đổi mật khẩu thành công!');
 }