Esempio n. 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CategoryFormRequest $request, Category $category)
 {
     // Update the $category
     $category->update($request->all());
     flash()->success('Category has been updated');
     return redirect('categories');
 }
 public function store(CategoryFormRequest $request)
 {
     $category = new Category(['name' => $request->get('name')]);
     $category->save();
     return redirect('admin/categories/create')->with('status', 'A new category has been created!');
     //        Session::flash('status', 'A new category has been created!');
     //        return view('backend.categories.create');
 }
Esempio n. 3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, CategoryFormRequest $request)
 {
     $category = Category::whereId($id)->firstOrFail();
     $category->name = $request->get('name');
     if (!empty($request->get('parent'))) {
         $category->parent_id = $request->get('parent');
     }
     $category->save();
     return redirect()->route('categories.edit', ['id' => $category->id])->with('status', 'The category ' . $category->name . ' has been updated!');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(CategoryFormRequest $request, Category $category)
 {
     //
     $category->update($request->all());
     return redirect('blogs')->with('message', 'The blog has been updated');
 }
 public function store(CategoryFormRequest $request)
 {
     $category = new Category(array('name' => $request->get('name')));
     $category->save();
     return redirect('/admin/categories/create')->with('status', 'A new category has been created!');
 }