Ejemplo n.º 1
0
 /**
  * Обновление рейтинга
  */
 public function updateRating($d = 0)
 {
     /*
      * @string $d дельта на которую изменить рейтинг
      */
     if ($d === 0) {
         return;
     }
     if (Vote::allow($this->Owner->id, get_class($this->Owner))) {
         $this->Owner->rating = $this->Owner->rating + $d;
         $this->Owner->save();
     }
     return $this->Owner->rating;
 }
Ejemplo n.º 2
0
 public function updateRating($d = 0)
 {
     if ($d === 0) {
         return;
     }
     if (Vote::allow($this->id, get_class($this))) {
         $this->rating = $this->rating + $d;
         $this->save();
     }
     // ОБновление рейтинга и кол-ва комментов пользователя
     if ($this->user_author) {
         $this->user_author->updateCommentsCount();
     }
     return $this->rating;
 }