/**
  *
  * @param Request $request
  * @return Response
  */
 public function store(StoreCategoryRequest $request)
 {
     $category = new Category($request->only(['name']));
     $category->user()->associate(Auth::user());
     $category->save();
     return response($category->transform(), Response::HTTP_CREATED);
 }
 public function update(StoreCategoryRequest $request, $categoryId)
 {
     $input = $request->all();
     $input['slug'] = str_replace(' ', '_', strtolower($input['name']));
     $category = Category::where('id', $categoryId)->update($input);
     return $this->createResponse($category);
 }
Beispiel #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  StoreCategoryRequest $request
  * @return RedirectResponse
  */
 public function store(StoreCategoryRequest $request) : RedirectResponse
 {
     $params = $request->all();
     $params['slug'] = strtolower($params['slug']);
     Category::create($params);
     return Redirect::route('back.category.index')->with('message', ucfirst(trans('back/category.success_stored')));
 }
Beispiel #4
0
 public function store(Requests\StoreCategoryRequest $request, $category_id = null)
 {
     $category = Categories::findOrNew($category_id);
     $category->title = strip_tags($request->get('title'));
     $seo_title = strip_tags($request->get('seo_title'));
     $category->seo_title = trim($seo_title) == '' ? $category->title : $seo_title;
     $category->seo_description = strip_tags($request->get('seo_description'));
     $category->seo_keywords = strip_tags($request->get('seo_keywords'));
     if ($request->has('update_slug')) {
         $category->resluggify();
     }
     $category->save();
     Notifications::add('Category saved', 'success');
     return redirect()->route('root-categories-edit', ['category_id' => $category->id]);
 }
 /**
  * @param StoreCategoryRequest $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function storeNewCategory(StoreCategoryRequest $request)
 {
     $formData = $request->all();
     Category::create($formData);
     return response()->json(['success' => true, 'Message' => 'Your category was created.']);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(StoreCategoryRequest $request, $id)
 {
     //
     // get this category
     $task = Category::where('id', $id)->update($request->except(['_method', '_token']));
     $message = 'Category with id "' . $id . '" updated';
     return \Redirect::route('categories.index')->with(['status' => $message]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param Requests\StoreCategoryRequest $request
  * @return Response
  */
 public function store(Requests\StoreCategoryRequest $request)
 {
     $params = array_merge($request->all(), ['user_id' => Auth::user()->id]);
     Category::create($params);
     return redirect('dashboard')->with('success', trans('flash.category_created'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  StoreCategory $category
  * @param  Requests\StoreCategoryRequest $request
  * @return Response
  */
 public function update($category, Requests\StoreCategoryRequest $request)
 {
     $category->update($request->all());
     $this->SyncServers($category, $request->input('server_list'));
     return redirect()->route('webpanel.store.categories.index');
 }