/**
  * Update the specified resource in storage.
  *
  * @param QuoteRequest $request
  * @param Quote        $quote
  *
  * @return Response
  * @internal param int $id
  */
 public function update(QuoteRequest $request, Quote $quote)
 {
     $quote->update($request->all());
     /**
      * @var array $selectedCategoriesIds
      * empty items are removed
      */
     $selectedCategoriesIds = array_except($request->input('categories'), ['']);
     /**
      * @var array $selectedCategoriesOfImagesIds
      * empty items are removed
      */
     $selectedCategoriesOfImagesIds = array_except($request->input('categories_of_images'), ['']);
     $quote->categories()->sync($selectedCategoriesIds);
     $quote->categoriesOfImages()->sync($selectedCategoriesOfImagesIds);
     flash()->success("Quote has been successfully updated!");
     return redirect()->back()->withInput();
 }