當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。