Skip to content

Instantly share code, notes, and snippets.

@achmadfatoni
Created August 18, 2017 12:34
Show Gist options
  • Save achmadfatoni/535fb95379b75623644ce7ee5e50cb4f to your computer and use it in GitHub Desktop.
Save achmadfatoni/535fb95379b75623644ce7ee5e50cb4f to your computer and use it in GitHub Desktop.
simple_api_lumen_single_controller
public function show($id)
{
$post = Post::find($id);
if (! $post) {
return response()->json([
'message' => 'post not found'
]);
}
return $post;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment