/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id, PostInterface $post_service, CategoryInterface $category_service) { if (!$post_service->show($id)) { return redirect('/post/')->with('status', 'Unknown error!'); } $post = $post_service->show($id); $categories = $category_service->getAll(); return view('posts.form', ['title' => "Edit Post", 'id' => $id, 'post' => $post, 'categories' => $categories]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, CategoryInterface $category_service) { if ($category_service->delete($id)) { /*return redirect('/category')->with('status', 'Category Deleted');*/ return response()->json(true); } else { /*return redirect('/category/'.$id)->with('warning', 'Unknown error!');*/ return response()->json(false); } }