/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { if (!\Input::has('file')) { $path_img = \Input::get('img-bk'); $alt_name = \GetNameImage::make('/', $path_img); } else { $ha = \Input::get('file'); $path_img = str_replace($this->name_project, '', $ha); $alt_name = \GetNameImage::make('/', $path_img); } $data = array('title' => \Input::get('title'), 'slug' => \Unicode::make(\Input::get('title')), 'content' => \Input::get('content'), 'cate_id' => \Input::get('cate_id'), 'path_thumb' => $path_img, 'alt_img' => $alt_name, 'show' => \Input::get('show'), 'sort' => \Input::get('sort')); $this->post->update($id, $data); $post_current = $this->post->find($id); $post_add = $this->post_add->whereGet('post_id', $post_current->id); $count = $post_add->count(); if ($count != 0) { $arr_add = \Input::get('attr'); $va_add = \Input::get('value_attr'); foreach ($arr_add as $k => $each) { $data = array('key' => $arr_add[$k], 'slug' => \Unicode::make($arr_add[$k]), 'value' => $va_add[$k]); $this->post_add->update($each->id, $data); } } \Notification::success('UPDATED !'); return \Redirect::route('admin.post.index'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { if (!\Input::has('file')) { $img_path = \Input::get('img-bk'); if (empty($img_path)) { $img_path = '/public/backend/img/image_thumbnail.gif'; } $img_name = \GetNameImage::make('/', $img_path); } else { $ha = \Input::get('file'); $img_path = str_replace($this->name_project, '', $ha); $img_name = \GetNameImage::make('/', $img_path); } $data = array('title' => \Input::get('title'), 'slug' => \Unicode::make(\Input::get('title')), 'content' => \Input::get('content'), 'image_path' => $img_path, 'image_name' => $img_name, 'status' => \Input::get('status'), 'order' => \Input::get('order')); $news = $this->news->find($id); $news->title = \Input::get('title'); $news->slug = \Unicode::make(\Input::get('title')); $news->content = \Input::get('content'); $news->image_path = $img_path; $news->image_name = $img_name; $news->status = \Input::get('status'); $news->order = \Input::get('order'); $news->save(); \Notification::success('UPDATED !'); return \Redirect::route('admin.tintuc.index'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function updatesanpham($sp_id) { if (!\Input::has('file')) { $img_path = \Input::get('img-bk'); if (empty($img_path)) { $img_path = '/public/backend/img/image_thumbnail.gif'; } $img_name = \GetNameImage::make('/', $img_path); } else { $ha = \Input::get('file'); $img_path = str_replace($this->name_project, '', $ha); $img_name = \GetNameImage::make('/', $img_path); } $sanpham = $this->sanpham->find($sp_id); $sanpham->name = \Input::get('name'); $sanpham->slug = \Unicode::make(\Input::get('name')); $sanpham->chatlieu = \Input::get('chatlieu'); $sanpham->mausac = \Input::get('mausac'); $sanpham->size = \Input::get('size'); $sanpham->style = \Input::get('style'); $sanpham->mota = \Input::get('mota'); $sanpham->image_path = $img_path; $sanpham->image_name = $img_name; $sanpham->status = \Input::get('status'); $sanpham->order = \Input::get('order'); $sanpham->danhmuc_id = \Input::get('danhmuc_id'); $sanpham->khuyenmai = \Input::get('khuyenmai'); $sanpham->save(); \Notification::success('UPDATED !'); return \Redirect::route('admin.sanpham.index', \Input::get('danhmuc_id')); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { if (!\Input::has('file')) { $img_path = \Input::get('img-bk'); if (empty($img_path)) { $img_path = '/public/backend/img/image_thumbnail.gif'; } $img_name = \GetNameImage::make('/', $img_path); } else { $ha = \Input::get('file'); $img_path = str_replace($this->name_project, '', $ha); $img_name = \GetNameImage::make('/', $img_path); } $danhmuc = $this->danhmuc->find($id); $danhmuc->title = \Input::get('title'); $danhmuc->slug = \Unicode::make(\Input::get('title')); $danhmuc->mota = \Input::get('mota'); $danhmuc->image_path = $img_path; $danhmuc->image_name = $img_path; $danhmuc->image_name = $img_path; $danhmuc->status = \Input::get('status'); $danhmuc->order = \Input::get('order'); $danhmuc->save(); \Notification::success('UPDATED !'); return \Redirect::route('admin.danhmuc.index'); }