/**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @param CategoryRequest $request
  * @return Response
  */
 public function update($id, CategoryRequest $request)
 {
     $input = $request->all();
     $this->categoryRepository->update($id, $input);
     Flash::message('Category updated');
     return Redirect()->route('categories');
 }
Exemplo n.º 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  App\Http\Requests\CategoryRequest $request
  * @param  int  $id
  * @return Response
  */
 public function update(CategoryRequest $request, $id)
 {
     $post = $this->cat_gestion->getById($id);
     //$this->authorize('change', $post);
     $this->cat_gestion->update($request->all(), $post);
     return redirect('cat')->with('ok', trans('back/blog.updated'));
 }
Exemplo n.º 3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  App\Http\Requests\PostUpdateRequest $request
  * @param  int  $id
  * @return Response
  */
 public function putUpdate(CategoryRequest $request, $id)
 {
     $getdata = $request->all();
     $userdet = array();
     if ($request->hasFile('banner_img')) {
         $file = $request->file('banner_img');
         $bannerimgNm = "banner_" . date("ymdHis") . '.' . $file->getClientOriginalExtension();
         $realPath = base_path() . '/public/uploaded/category/';
         $resizePath = base_path() . '/public/uploaded/category/thumb/' . $bannerimgNm;
         $openMakePath = $realPath . $bannerimgNm;
         $request->file('banner_img')->move($realPath, $bannerimgNm);
         Image::make($openMakePath)->resize(400, 500)->save($resizePath);
     } else {
         $bannerimgNm = $getdata['oldbannerimage'];
     }
     if ($request->hasFile('background_img')) {
         $file = $request->file('background_img');
         $bckgndimgNm = "backgnd_" . date("ymdHis") . '.' . $file->getClientOriginalExtension();
         $realPath = base_path() . '/public/uploaded/category/';
         $resizePath = base_path() . '/public/uploaded/category/thumb/' . $bckgndimgNm;
         $openMakePath = $realPath . $bckgndimgNm;
         $request->file('background_img')->move($realPath, $bckgndimgNm);
         Image::make($openMakePath)->resize(200, 300)->save($resizePath);
     } else {
         $bckgndimgNm = $getdata['oldbackgndimg'];
     }
     if ($request->hasFile('icon_img')) {
         $file = $request->file('icon_img');
         $iconimgNm = "icon_" . date("ymdHis") . '.' . $file->getClientOriginalExtension();
         $realPath = base_path() . '/public/uploaded/category/';
         $resizePath = base_path() . '/public/uploaded/category/thumb/' . $iconimgNm;
         $openMakePath = $realPath . $iconimgNm;
         $request->file('icon_img')->move($realPath, $iconimgNm);
         Image::make($openMakePath)->resize(50, 50)->save($resizePath);
     } else {
         $iconimgNm = $getdata['oldiconimage'];
     }
     $active = isset($getdata['active']) ? $getdata['active'] : '0';
     $hidden = isset($getdata['is_hidden']) ? $getdata['is_hidden'] : '0';
     $userdet['_token'] = $getdata['_token'];
     $userdet['name'] = $getdata['name'];
     $userdet['category_slug'] = $getdata['slug'];
     $userdet['background_img'] = $bckgndimgNm;
     $userdet['banner_img'] = $bannerimgNm;
     $userdet['icon_img'] = $iconimgNm;
     $userdet['active'] = $active;
     $userdet['is_hidden'] = $hidden;
     $this->category_gestion->update($userdet, $id);
     $request->session()->flash('alert-success', 'Category has been updated successfully');
     return redirect('admin/category');
     exit;
 }
Exemplo n.º 4
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(CategoryRepository $categoryRepository)
 {
     $category = $categoryRepository->update($this->id, $this->params);
     return true;
 }
Exemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @param CategoryRequest $request
  * @return Response
  */
 public function update($id, CategoryRequest $request)
 {
     $this->categoryRepository->update($id, $request->input('name'));
     Flash::success('Category updated');
     return redirect()->route('admin.category.index');
 }