bosnadev / repository

Laravel Repositories is a package for Laravel 5 which is used to abstract the database layer. This makes applications much easier to maintain.
https://bosnadev.com
823 stars 233 forks source link

Support for withTrashed() and onlyTrashed() ? #88

Open avramovic opened 7 years ago

avramovic commented 7 years ago

I'm using SoftDeletes on my model and if I try to query trashed models it doesn't seem to work.

First I've tried this:

$item = $itemRepo->withTrashed()->all();

It says there is no method withTrashed() on my repository. Then I tried to make criteria:

...
public function apply($model, Repository $repository) {
  return $model->withTrashed();
}
...

...but it says there is no method withTrashed() on Builder class. It seems $model here is the query builder, not the model itself.

Same goes for onlyTrashed(). Is there any way to use these methods with your Repository package?