I would like to return code 201 Created
in some cases in my API. How can I do this?
I discovered accidentally that adding @status «code»
to the method documentation alters the success response code, as follows:
/**
* Creates a post.
* @status 201
*
* @param string $title {@from body} Post title
* @param string $message {@from body} Post body
*/
protected function post($title, $message) {
return Posts::create(compact('title', 'message'));
}