Skip to content

Instantly share code, notes, and snippets.

@achmadfatoni
Created August 19, 2017 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achmadfatoni/8e6921f2e8a7296485f9303bad9a3326 to your computer and use it in GitHub Desktop.
Save achmadfatoni/8e6921f2e8a7296485f9303bad9a3326 to your computer and use it in GitHub Desktop.
delete post
public function delete($id)
{
$post = Post::find($id);
if ($post) {
$post->delete();
return response()->json([
'message' => 'Post has been deleted'
]);
}
return response()->json([
'message' => 'Post not found'
], 404);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment