/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, ApiCategoryInterface $api_category) { if ($api_category->deleteCategory($id)) { return response()->json(['status' => 'error', 'message' => 'Category deleted']); //return redirect('/category')->with('status', 'Category Deleted'); } else { return response()->json(['status' => 'error', 'message' => 'Error in category delete process']); //return redirect('/category')->with('warning', 'Unknown Error'); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id, ApiPostInterface $api_post, ApiCategoryInterface $api_category) { $post_with_category_ids = $api_post->getPostwithCategoryIds($id); $categories = $api_category->getAllCategories(); return view('posts.form', ['post' => $post_with_category_ids, 'categories' => $categories, 'title' => 'Create Post']); }