/**
  * Add points to a users account
  *
  * @param integer $points
  * The amount of points to add to a user
  */
 public function addPoints($points)
 {
     if (!is_numeric($points)) {
         throw new SystemException('Points must be an integer');
     }
     $this->user->points += $points;
     $this->user->points_this_week += $points;
     $this->user->points_today += $points;
     if ($this->user->forceSave()) {
         // Process any activities awarded on points achievement
         Points::process($this->user);
         Event::fire('dma.friends.user.pointsEarned', [$this->user, $points]);
         $params = ['user' => $this->user, 'points_earned' => $points];
         FriendsLog::points($params);
     }
 }
 public function testPoints()
 {
     $user = FactoryMuffin::create('RainLab\\User\\Models\\User');
     $params = ['user' => $user, 'points_earned' => rand()];
     FriendsLog::points($params);
 }