Exemplo n.º 1
0
 /**
  * @param CategoryFormRequest         $request
  * @param CategoryRepositoryInterface $repository
  * @param Category                    $category
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(CategoryFormRequest $request, CategoryRepositoryInterface $repository, Category $category)
 {
     $categoryData = ['name' => $request->input('name')];
     $repository->update($category, $categoryData);
     Session::flash('success', 'Category "' . $category->name . '" updated.');
     Preferences::mark();
     if (intval(Input::get('return_to_edit')) === 1) {
         Session::put('categories.edit.fromUpdate', true);
         return Redirect::route('categories.edit', [$category->id]);
     }
     // redirect to previous URL.
     return Redirect::to(Session::get('categories.edit.url'));
 }
 /**
  * @param CategoryFormRequest $request
  * @param CRI                 $repository
  * @param Category            $category
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(CategoryFormRequest $request, CRI $repository, Category $category)
 {
     $categoryData = ['name' => $request->input('name')];
     $repository->update($category, $categoryData);
     Session::flash('success', strval(trans('firefly.updated_category', ['name' => e($category->name)])));
     Preferences::mark();
     if (intval(Input::get('return_to_edit')) === 1) {
         Session::put('categories.edit.fromUpdate', true);
         return redirect(route('categories.edit', [$category->id]));
     }
     // redirect to previous URL.
     return redirect(session('categories.edit.url'));
 }