Created
August 18, 2017 12:37
-
-
Save achmadfatoni/0f27bcfa2d0e31843cd451902dc84f13 to your computer and use it in GitHub Desktop.
simple_api_lumen_update_controller
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 update(Request $request, $id) | |
{ | |
$post = Post::find($id); | |
if ($post) { | |
$post->update($request->all()); | |
return response()->json([ | |
'message' => 'Post has been updated' | |
]); | |
} | |
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