Created
August 19, 2017 04:49
-
-
Save achmadfatoni/8e6921f2e8a7296485f9303bad9a3326 to your computer and use it in GitHub Desktop.
delete post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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