本文整理匯總了PHP中Illuminate\Database\Eloquent\Model::withTrashed方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::withTrashed方法的具體用法?PHP Model::withTrashed怎麽用?PHP Model::withTrashed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Eloquent\Model
的用法示例。
在下文中一共展示了Model::withTrashed方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: apply
/**
* @param Model $model
* @param Repository $repository
*
* @return mixed
*/
public function apply(Model $model, Repository $repository)
{
return $model->withTrashed();
}
示例2: applySoftDeletesQuery
/**
* Apply soft-delete changes to the query.
*
* @param Model|Builder $query
* @return mixed
*/
protected function applySoftDeletesQuery($query)
{
if ($this->withTrashed === true) {
return $query->withTrashed();
} elseif ($this->onlyTrashed === true) {
return $query->onlyTrashed();
}
return $query;
}
示例3: startWithTrashed
/**
* Reset and includes soft deletes for following queries.
*
* @return $this
*/
public function startWithTrashed()
{
/**
* Save to conditons.
*/
$this->addCondition('withTrashed', 'withTrashed');
$this->model = $this->model->withTrashed();
return $this;
}
示例4: startWithTrashed
/**
* Reset and includes soft deletes for following queries.
*
* @return $this
*/
public function startWithTrashed()
{
$this->reset(new Action(__METHOD__, []));
/**
* Save to conditons.
*/
$this->addCondition('withTrashed', 'withTrashed');
$this->model = $this->model->withTrashed();
return $this;
}
示例5: withTrashed
/**
* Retrieve all data of repository deleted
*
* @param array $columns
*
* @return mixed
*/
public function withTrashed($columns = ['*'])
{
$this->applyCriteria();
$this->applyScope();
if ($this->model instanceof Builder) {
$results = $this->model->withTrashed()->get($columns);
} else {
$results = $this->model->withTrashed()->get($columns);
}
$this->resetModel();
$this->resetScope();
return $this->parserResult($results);
}
示例6: restored
/**
* Restore a model
*
* @param int $id
*/
public function restored($id)
{
$object = $this->model->withTrashed()->find($id);
$object->restore();
}
示例7: byIdWithTrashed
/**
* Get single model by slug
*
* @param string slug
* @return object object of model
*/
public function byIdWithTrashed($id)
{
return $this->model->withTrashed()->find($id);
}