예제 #1
0
 /**
  * Perform a model update operation.
  *
  * @param  October\Rain\Halcyon\Builder  $query
  * @param  array  $options
  * @return bool
  */
 protected function performUpdate(Builder $query, array $options = [])
 {
     $dirty = $this->getDirty();
     if (count($dirty) > 0) {
         // If the updating event returns false, we will cancel the update operation so
         // developers can hook Validation systems into their models and cancel this
         // operation if the model does not pass validation. Otherwise, we update.
         if ($this->fireModelEvent('updating') === false) {
             return false;
         }
         $dirty = $this->getDirty();
         if (count($dirty) > 0) {
             $numRows = $query->update($dirty);
             $this->fireModelEvent('updated', false);
         }
     }
     return true;
 }