/**
  * Add the only-trashed extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $builder
  * @return void
  */
 protected function addOnlyTrashed(Builder $builder)
 {
     $builder->macro('onlyTrashed', function (Builder $builder) {
         $model = $builder->getModel();
         $this->remove($builder, $model);
         $builder->getQuery()->whereNotNull($model->getQualifiedDeletedAtColumn());
         return $builder;
     });
 }
Beispiel #2
0
 /**
  * Add the only-trashed extension to the builder.
  *
  * @param  \Illuminate\Database\Eloquent\Builder  $builder
  * @return void
  */
 protected function addOnlyTrashed(Builder $builder)
 {
     $builder->macro('onlyTrashed', function (Builder $builder) {
         $model = $builder->getModel();
         $builder->withoutGlobalScope($this)->whereNotNull($model->getQualifiedDeletedAtColumn());
         return $builder;
     });
 }