Esempio n. 1
0
 /**
  * Add the given comment to the content.
  *
  * @param string                          $text
  * @param \Fahita\RealTime\Content                 $content
  * @param \Fahita\Contracts\UserInterface $user
  *
  * @return array|null
  */
 public function add($text, Content $content, UserInterface $user)
 {
     if ($this->validator->validateAdding(compact('text'))) {
         // store the comment in the database
         $comment = $this->comments->create($text, $content->type(), $content->id(), $user);
         // cache the created comment
         return $this->cache->add($comment, $content);
     }
 }