Get a new query builder that doesn't have any global scopes.
public newQueryWithoutScopes ( ) : |
||
Résultat |
/** * Add a basic where clause to the query. * * @param string $column * @param string $operator * @param mixed $value * @param string $boolean * @return $this */ public function where($column, $operator = null, $value = null, $boolean = 'and') { if ($column instanceof Closure) { $query = $this->model->newQueryWithoutScopes(); call_user_func($column, $query); $this->query->addNestedWhereQuery($query->getQuery(), $boolean); } else { call_user_func_array(array($this->query, 'where'), func_get_args()); } return $this; }
/** * Wrap the given value with the parent query's grammar. * * @param string $value * @return string */ public function wrap($value) { return $this->parent->newQueryWithoutScopes()->getQuery()->getGrammar()->wrap($value); }
/** * Get new query. * * @return \Illuminate\Database\Eloquent\Builder */ public function newQuery() { return $this->model->newQueryWithoutScopes(); }
/** * Get an array of the constraints applied by the scope. * * @param \Illuminate\Database\Eloquent\Model $model * @return array */ protected function getScopeConstraints(Model $model) { $builder = $model->newQueryWithoutScopes(); $this->apply($builder, $model); return (array) $builder->getQuery()->wheres; }
/** * Get the query for restoration. * * @param \Illuminate\Database\Eloquent\Model $model * @return \Illuminate\Database\Eloquent\Builder */ protected function getQueryForModelRestoration($model) { return $model->newQueryWithoutScopes(); }
/** * Assert that a model was soft deleted. * * @param Model $model * @return $this */ protected function assertModelTrashed(Model $model) { /** Cannot use `fresh()` because it is different between 5.2 and 5.3. */ $fresh = $model->newQueryWithoutScopes()->where($model->getKeyName(), $model->getKey())->first(); PHPUnit::assertNotNull($fresh, 'Model has been removed from the database.'); PHPUnit::assertTrue($fresh->trashed(), 'Model is not trashed.'); return $this->seeModelInDatabase($model, [$model->getKeyName() => $model->getKey()]); }