performUpdate() защищенный Метод

Perform a model update operation.
protected performUpdate ( Builder $query, array $options = [] ) : boolean
$query Builder
$options array
Результат boolean
Пример #1
0
 /**
  * (non-PHPdoc)
  * @see \Illuminate\Database\Eloquent\Model::performUpdate()
  */
 public function performUpdate(Builder $query, array $options = [])
 {
     if (!Auth::user() instanceof User) {
         App::error(function (InvalidUserException $exception) {
             Log::error($exception);
             return 'Access denid for creating a new ' . get_called_class();
         });
     }
     $this->attributes[self::UPDATED_AT] = new \DateTime('now', new \DateTimeZone(env('APP_TIMEZONE', 'UTC')));
     $this->attributes[self::UPDATED_BY] = Auth::user()->id;
     return parent::performUpdate($query, $options);
 }
Пример #2
0
 /**
  * Perform a model update operation.
  *
  * @param  \Illuminate\Database\Eloquent\Builder $query
  * @param  array $options
  *
  * @return bool
  */
 protected function performUpdate(EloquentBuilder $query, array $options = [])
 {
     if (parent::performUpdate($query, $options)) {
         if ($this->real_depth != $this->old_real_depth && $this->isMoved === true) {
             $action = $this->real_depth > $this->old_real_depth ? 'increment' : 'decrement';
             $amount = abs($this->real_depth - $this->old_real_depth);
             $this->subqueryClosureBy('descendant')->{$action}($this->getRealDepthColumn(), $amount);
         }
         return true;
     }
     return false;
 }