Exemplo n.º 1
0
 public static function add($data, $returnInfo = false)
 {
     $review = new Review();
     $uid = \Yii::$app->user->getId();
     if ($uid) {
         $review->uid = $uid;
     }
     $review->pid = $data['pid'];
     $review->blog_id = $data['blog_id'];
     $review->nickname = $data['nickname'];
     $review->content = htmlspecialchars(strip_tags($data['content']));
     $review->time = time();
     $result = $review->insert();
     if ($result) {
         Blog::reviewInc($review->blog_id);
         if ($returnInfo) {
             return $review;
         }
     }
     return $result;
 }