Esempio n. 1
0
 /**
  * @param Post   $post
  * @param string $title
  * @param string $body
  * @param null   $author
  * @return Comment
  */
 protected function createComment(Post $post, $title = 'testing title', $body = 'testing body', $author = null)
 {
     $comment = new Comment(['title' => $title, 'body' => $body]);
     if ($author) {
         $comment->author()->associate($author);
     }
     return $post->comments()->save($comment);
 }