protected function makeContent(Article $article, $content_id) { $poss_articles = $article->contents()->lists('id')->all(); if (in_array($content_id, $poss_articles)) { $article->content_id = $content_id; $article->save(); return $this->respondWithItem($article, new ArticleTransformer()); } return $this->errorInternalError('The content specified to make active doesn\'t appear to be related to the article.'); }