public function remove(Builder $builder, Model $model) { $column = $model->getQualifiedSingleServiceTypeColumn(); $query = $builder->getQuery(); $bindings = $query->getRawBindings()['where']; foreach ((array) $query->wheres as $key => $where) { if ($this->isSingleServiceInheritanceConstraint($where, $column)) { unset($query->wheres[$key]); foreach ($where['values'] as $value) { if (($binding_key = array_search($value, $bindings)) >= 0) { unset($bindings[$binding_key]); } } $query->setBindings(array_values($bindings)); $query->wheres = array_values($query->wheres); } } }
/** * Set the keys for a save update query. * * @param Builder $query * @return Builder */ protected function setKeysForSaveQuery(Builder $query) { $query->where($this->getKeyName(), 'eq', $this->getKeyForSaveQuery()); return $query; }