示例#1
0
 /**
  * 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'));
 }
示例#2
0
 /**
  * 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");
 }