src/Model/AchievementProgress.php
public function save(array $options = [])
    {
        if (is_null($this->id)) {
            $this->id = Uuid::uuid4()->toString();
        }
        $recently_unlocked = false;
        if (is_null($this->unlockedAt) && $this->isUnlocked()) {
            $recently_unlocked = true;
            $this->points = $this->details->points;
            $this->unlocked_at = Carbon::now();
        }

        $result = parent::save($options);

        // Gets the achievement class for this progress
        $class = $this->details->getClass();

        if ($recently_unlocked) {
            // Runs the callback set to run when the achievement is unlocked.
            $class->triggerUnlocked($this);
        } elseif ($this->points >= 0) {
            // Runs the callback set to run when progress has been made on the achievement.
            $class->triggerProgress($this);
        }

        return $result;
    }
public function save(array $options = [])
    {
        if (is_null($this->id)) {
            $this->id = Uuid::uuid4()->toString();
        }
        $recently_unlocked = false;
        if (is_null($this->unlockedAt) && $this->isUnlocked()) {
            $recently_unlocked = true;
            $this->points = $this->details->points;
            $this->unlocked_at = Carbon::now();
        }

        $result = parent::save($options);

        // Gets the achievement class for this progress
        $class = $this->details->getClass();

        if ($recently_unlocked) {
            // Runs the callback set to run when the achievement is unlocked.
            $class->triggerUnlocked($this);
        } elseif ($this->points >= 0) {
            // Runs the callback set to run when progress has been made on the achievement.
            $class->triggerProgress($this);
        }

        return $result;
    }
public function save ( array $ options = [ ] ) { if ( is_null ( $ this -> id ) ) { $ this -> id = Uuid :: uuid4 ( ) -> toString ( ) ; } $ recently_unlocked = false ; if ( is_null ( $ this -> unlockedAt ) && $ this -> isUnlocked ( ) ) { $ recently_unlocked = true ; $ this -> points = $ this -> details -> points ; $ this -> unlocked_at = Carbon :: now ( ) ; } $ result = parent :: save ( $ options ) ; // Gets the achievement class for this progress $ class = $ this -> details -> getClass ( ) ; if ( $ recently_unlocked ) { // Runs the callback set to run when the achievement is unlocked. $ class -> triggerUnlocked ( $ this ) ; } elseif ( $ this -> points >= 0 ) { // Runs the callback set to run when progress has been made on the achievement. $ class -> triggerProgress ( $ this ) ; } return $ result ; }
Overloads save method.

@param  array  $options
@return bool
Overloads save method .