当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::onlyTrashed方法代码示例

本文整理汇总了PHP中Illuminate\Database\Eloquent\Model::onlyTrashed方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::onlyTrashed方法的具体用法?PHP Model::onlyTrashed怎么用?PHP Model::onlyTrashed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::onlyTrashed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:artissant,项目名称:laravel,代码行数:15,代码来源:SoftDeletes.php

示例2: startWithTrashedOnly

 /**
  * Reset and only includes soft deletes for following queries.
  *
  * @return $this
  */
 public function startWithTrashedOnly()
 {
     /**
      * Save to conditons.
      */
     $this->addCondition('onlyTrashed', 'onlyTrashed');
     $this->model = $this->model->onlyTrashed();
     return $this;
 }
开发者ID:aaronjan,项目名称:housekeeper,代码行数:14,代码来源:Plan.php

示例3: startWithTrashedOnly

 /**
  * Reset and only includes soft deletes for following queries.
  *
  * @return $this
  */
 public function startWithTrashedOnly()
 {
     $this->reset(new Action(__METHOD__, []));
     /**
      * Save to conditons.
      */
     $this->addCondition('onlyTrashed', 'onlyTrashed');
     $this->model = $this->model->onlyTrashed();
     return $this;
 }
开发者ID:sandeeprajoria,项目名称:Housekeeper,代码行数:15,代码来源:BaseRepository.php

示例4: onlyTrashed

 /**
  * Retrieve all data of repository deleted
  *
  * @param array $columns
  *
  * @return mixed
  */
 public function onlyTrashed($columns = ['*'])
 {
     $this->applyCriteria();
     $this->applyScope();
     if ($this->model instanceof Builder) {
         $results = $this->model->onlyTrashed()->get($columns);
     } else {
         $results = $this->model->onlyTrashed()->get($columns);
     }
     $this->resetModel();
     $this->resetScope();
     return $this->parserResult($results);
 }
开发者ID:mayconpaivac,项目名称:l5-repository,代码行数:20,代码来源:BaseRepository.php

示例5: emptyTrash

 /**
  * Empty trash
  *
  * @param int $day
  * @return array $ids
  */
 public function emptyTrash($day = 60)
 {
     //Convert day to carbon object
     $date = Carbon::now()->subDays($day);
     //Prepare the query to get only trash
     $query = $this->model->onlyTrashed();
     //Archived since
     $query->where('deleted_at', '<', $date->toDateTimeString());
     //Execute the query
     $trash = $query->get();
     //By default, no ids
     $ids = [];
     //For each results, add ids
     foreach ($trash as $result) {
         $ids[] = $result->id;
     }
     //If we have archive to delete
     if (!empty($ids)) {
         $this->db->table($this->model->getTable())->whereIn('id', $ids)->delete();
     }
     return $ids;
 }
开发者ID:ellipsesynergie,项目名称:backend-skeleton,代码行数:28,代码来源:AbstractRepository.php

示例6: apply

 /**
  * @param Model      $model
  * @param Repository $repository
  *
  * @return mixed
  */
 public function apply(Model $model, Repository $repository)
 {
     return $model->onlyTrashed();
 }
开发者ID:draperstudio,项目名称:eloquent-repositories,代码行数:10,代码来源:OnlyTrashed.php


注:本文中的Illuminate\Database\Eloquent\Model::onlyTrashed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。