Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function decrement($column, $decrement = 1)
 {
     if ($this->model->exists()) {
         $this->model->{$column} -= $decrement;
         $this->where($this->model->getPrimaryKey(), '=', $this->model->getPrimaryKeyValue());
     }
     $updated = parent::decrement($column, $decrement);
     if ($this->model->exists()) {
         $this->model->synchronize();
     }
     return $updated;
 }
Пример #2
0
 /**
  * Sets the criterion used when lazy loading related records.
  *
  * @access  protected
  */
 protected function lazyCriterion()
 {
     $this->where($this->getForeignKey(), '=', $this->parent->getPrimaryKeyValue());
 }