/** * Remove the specified Post from storage. * * @param int $id * * @return Response */ public function destroy($id) { $post = $this->postRepository->find($id); if (empty($post)) { Flash::error('Post not found'); return redirect(route('posts.index')); } $this->postRepository->delete($id); Flash::success('Post deleted successfully.'); return redirect(route('posts.index')); }
/** * Remove the specified Post from storage. * DELETE /posts/{id} * * @param int $id * * @return Response */ public function destroy($id) { $this->postRepository->apiDeleteOrFail($id); return $this->sendResponse($id, "Post deleted successfully"); }