Skip to content

Instantly share code, notes, and snippets.

@achmadfatoni
Created August 18, 2017 12:37
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/0f27bcfa2d0e31843cd451902dc84f13 to your computer and use it in GitHub Desktop.
Save achmadfatoni/0f27bcfa2d0e31843cd451902dc84f13 to your computer and use it in GitHub Desktop.
simple_api_lumen_update_controller
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