本文整理汇总了PHP中Illuminate\Database\Eloquent\Model::newQueryWithoutScopes方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::newQueryWithoutScopes方法的具体用法?PHP Model::newQueryWithoutScopes怎么用?PHP Model::newQueryWithoutScopes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Model
的用法示例。
在下文中一共展示了Model::newQueryWithoutScopes方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: where
/**
* 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;
}
示例2: wrap
/**
* 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);
}
示例3: newQuery
/**
* Get new query.
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function newQuery()
{
return $this->model->newQueryWithoutScopes();
}
示例4: getScopeConstraints
/**
* 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;
}
示例5: getQueryForModelRestoration
/**
* Get the query for restoration.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return \Illuminate\Database\Eloquent\Builder
*/
protected function getQueryForModelRestoration($model)
{
return $model->newQueryWithoutScopes();
}
示例6: assertModelTrashed
/**
* 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()]);
}