Exemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CreateCategoryRequest $request, $category)
 {
     $data = $request->input();
     $category->fill($data);
     $category->save();
     return Redirect()->route('categories');
 }
Exemplo n.º 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(CreateCategoryRequest $request, $id)
 {
     $category = Category::findOrFail($id);
     $category->update($request->all());
     session()->flash('flash_message', 'Data Updated!');
     return redirect('categories');
 }
Exemplo n.º 3
0
 /**
  * Store a newly created Category in storage.
  *
  * @param CreateCategoryRequest $request
  *
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $input = $request->all();
     $category = $this->categoryRepository->create($input);
     Flash::success('Category saved successfully.');
     return redirect(route('categories.index'));
 }
 /**
  * Store a newly created Category in storage.
  *
  * @param CreateCategoryRequest $request
  *
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $input = $request->all();
     $category = $this->categoryRepository->create($input);
     $messages = "Transporte Creado";
     Toastr::success($messages, $title = null, $options = ['positionClass' => 'toast-bottom-right']);
     return redirect(route('categories.index'));
 }
Exemplo n.º 5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateCategoryRequest $request
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $category = new Category();
     $category->fill($request->all());
     $category->save();
     $message = trans('messages.category_created_successfully');
     Flash::success($message);
     return redirect()->route('admin.categories.index');
 }
Exemplo n.º 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $category = Category::create(['title' => $request->input('title')]);
     if ($category) {
         flash()->success('Category created successfully!');
     } else {
         flash()->error('Oops! Something went wrong.');
     }
     return redirect(route('backend'));
 }
Exemplo n.º 7
0
 /**
  * Store a newly created Category in storage.
  *
  * @param CreateCategoryRequest $request
  *
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $input = $request->all();
     $input['objectId'] = str_random(10);
     if ($request->file('image')) {
         $image = $this->uploadImage($request->file('image'), '/categories_photo/');
         $input['image'] = $image['resize_url'][0];
     }
     $category = $this->categoryRepository->create($input);
     Flash::success('Category saved successfully.');
     return redirect(route('categories.index'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $catId - id of a category
  * @param  int  $newsId - id of a news article, in the same category
  * @return Response
  */
 public function update(CreateCategoryRequest $request, $catId)
 {
     // find by $catId
     $category = Category::find($catId);
     // if no category found
     if (!$category) {
         // set response as an error
         return Response()->json(['message' => 'The category could not be found', 'code' => 404], 404);
     }
     // get title and descriptions
     $title = $request->get('title');
     $description = $request->get('description');
     // set the new title and description if one presenet
     $category->title = $title ? $title : $category->title;
     $category->description = $description ? $description : $category->description;
     // save the category
     $category->save();
     // set success response as json with data
     return response()->json(['message' => "Category id '{$catId}' successfully updated", 'code' => 200], 200);
 }
 /**
  * Update the specified Category in storage.
  *
  * @param  int    $id
  * @param CreateCategoryRequest $request
  *
  * @return Response
  */
 public function update($id, CreateCategoryRequest $request)
 {
     /** @var Category $category */
     $category = Category::find($id);
     if (empty($category)) {
         Flash::error('Category not found');
         return redirect(route('admin.categories.index'));
     }
     $category->fill($request->all());
     $category->save();
     Flash::message('Category updated successfully.');
     return redirect(route('admin.categories.index'));
 }
Exemplo n.º 10
0
 /**
  * Store the category.
  *
  * @param CreateCategoryRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postCreateTerm(CreateCategoryRequest $request)
 {
     $category = $request->only(['name', 'description']);
     // @todo create TermService to handle categories.
     return redirect()->route('admin.ingredient-terms.list');
 }
Exemplo n.º 11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $data = $request->only('name');
     Category::create($data);
     return redirect()->route('admin.' . self::URI . '.index');
 }
Exemplo n.º 12
0
 /**
  * Store a newly created category in storage.
  *
  * @param CreateCategoryRequest|Request $request
  */
 public function store(CreateCategoryRequest $request)
 {
     Category::create($request->all());
     return redirect()->route('admin.category.index');
 }
 public function update($id, Requests\CreateCategoryRequest $request)
 {
     $category = Category::findOrFail($id);
     $category->update($request->all());
     return redirect('kategoriat');
 }
 /**
  * Update the specified Category in storage.
  *
  * @param  int    $id
  * @param CreateCategoryRequest $request
  *
  * @return Response
  */
 public function update($id, CreateCategoryRequest $request)
 {
     $category = $this->categoryRepository->findCategoryById($id);
     if (empty($category)) {
         Flash::error('Category not found');
         return redirect(route('categories.index'));
     }
     $category = $this->categoryRepository->update($category, $request->all());
     Flash::message('Category updated successfully.');
     return redirect(route('categories.index'));
 }
Exemplo n.º 15
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CreateCategoryRequest $request)
 {
     $category = App\Category::create($request->all());
     flash()->success('Success!', 'New category created: <strong>' . e($request->input('name')) . '</strong>.');
     return redirect()->action('CategoryListsController@show', [$category->id]);
 }
Exemplo n.º 16
0
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateCategoryRequest|Request $request
  *
  * @param Category                      $category
  *
  * @return \Illuminate\Http\Response
  */
 public function store(CreateCategoryRequest $request, Category $category)
 {
     $category->create($request->all());
     return redirect()->route('admin.categories.index')->withMessage('<b>Success!</b> category created successfully')->withClass('success');
 }
Exemplo n.º 17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\CreateCategoryRequest $request)
 {
     Categories::create($request->all());
     return redirect()->back();
 }
Exemplo n.º 18
0
 /**
  * Persists a category to the database.
  * Uses CreateCategoryRequest request type.
  * 
  * @param  CreateCategoryRequest $request [description]
  * @return [type]                         [description]
  */
 public static function persist(CreateCategoryRequest $request)
 {
     $request->validate();
     $category = CategoryFactory::make($request->all());
     return Auth::user()->categories()->save($category);
 }