/**
  * Show the form for editing the specified resource.
  *
  * @param $categoryId
  * @param $productId
  * @return Response
  */
 public function edit($categoryId, $productId)
 {
     $category = Category::findOrFail($categoryId);
     $product = $category->products()->find($productId);
     //get all categories for the product, to change the category if needed
     $categories = Category::all()->linkNodes();
     return view('products.edit', compact('product', 'category', 'categories'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $categories = Category::all()->linkNodes();
     $category = Category::findOrFail($id);
     return view('categories.edit', compact('category', 'categories'));
 }