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


PHP Builder::onlyTrashed方法代码示例

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


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

示例1: applyFilters

 private function applyFilters(Builder $query, $expression, $value, $multiple = false)
 {
     $equalsFilter = false;
     $field = null;
     $filter = explode(":", $expression);
     // filter[field:filter]=value
     if (count($filter) == 2) {
         $field = $filter[0];
         $filter = $filter[1];
     } else {
         $equalsFilter = true;
         $field = $expression;
     }
     // filter[field]=value
     if ($equalsFilter) {
         $multiple ? $query->orWhere($field, '=', $value) : $query->where($field, '=', $value);
     }
     // filter[field:between]=A,B
     if ($this->isBetweenFilter($filter)) {
         $betweenValues = $this->getBetweenValues($value);
         if (count($betweenValues) != 2) {
             throw new BadRequestHttpException("Please specify two numbers to filter between");
         }
         $multiple ? $query->orWhereBetween($field, $betweenValues) : $query->whereBetween($field, $betweenValues);
     }
     // filter[field:[after, before, greater_than, less_than]]=value
     if ($this->isComparisonFilter($filter)) {
         if ($this->isDateFilter($field)) {
             $value = Carbon::createFromTimestamp($value);
         }
         $comparisonFilter = $this->getComparisonFilter($filter);
         $multiple ? $query->orWhere($field, $comparisonFilter, $value) : $query->where($field, $comparisonFilter, $value);
     }
     // filter[field:[contains, ends_with, starts_with]]=value
     if ($this->isWildcardFilter($filter)) {
         $value = $this->getLikeWildcard($filter, $value);
         $multiple ? $query->orWere($field, 'like', $value) : $query->where($field, 'like', $value);
     }
     // filter[field:trashed]=true
     if ($this->isTrashedFilter($field)) {
         $query->onlyTrashed();
     }
 }
开发者ID:hrobinson,项目名称:laravel-core,代码行数:43,代码来源:FilterableRepository.php

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

示例3: 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

示例4: 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

示例5: scopeCancelled

 /**
  * Scope a query to only include activities that are cancelled/soft deleted.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $query  the query to activities to be scoped
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeCancelled($query)
 {
     $query->onlyTrashed()->latest('datetime_start');
 }
开发者ID:jonnylow,项目名称:CrowdSourcingApplicationWeb,代码行数:10,代码来源:Activity.php

示例6: handle

 /**
  * Handle the query.
  *
  * @param TableBuilder $builder
  * @param Builder      $query
  */
 public function handle(TableBuilder $builder, Builder $query)
 {
     $query->onlyTrashed();
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:10,代码来源:TrashQuery.php


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