<commit_before><?php
/**
 * Laravel 4 Repository classes
 *
 * @author   <NAME> <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT
 * @package  l4-repository
 */

namespace anlutro\LaravelRepository;

use Illuminate\Database\Eloquent\Model;

class SoftDeletingEloquentRepository extends EloquentRepository
{

    /**
     * @var boolean
     */
    protected $onlyTrashed = false;

    /**
     * @var boolean
     */
    protected $withTrashed = false;

    /**
     * @param \Illuminate\Database\Eloquent\Model $model
     */
    public function restore($model)
    {
        $model->restore();
    }

    /**
     * Limit to trashed entities.
     */
    public function onlyTrashed()
    {
        $this->onlyTrashed = true;
        $this->withTrashed = false;
    }

    /**
     * Return trashed entites aswell.
     */
    public function withTrashed()
    {
        $this->onlyTrashed = false;
        $this->withTrashed = true;
    }

    /**
     * {@inheritdoc}
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
    protected function newQuery()
    {
        if ($this->onlyTrashed === true) {
            return call_user_func([$this->model, 'onlyTrashed']);
        }

        if ($this->withTrashed === true) {
            return call_user_func([$this->model, 'withTrashed']);
        }

        return parent::newQuery();
    }

}
<commit_msg>Maybe this will work? (not tested)<commit_after><?php
/**
 * Laravel 4 Repository classes
 *
 * @author   <NAME> <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT
 * @package  l4-repository
 */

namespace anlutro\LaravelRepository;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class SoftDeletingEloquentRepository extends EloquentRepository
{

    /**
     * @var boolean
     */
    protected $onlyTrashed = false;

    /**
     * @var boolean
     */
    protected $withTrashed = false;

    /**
     * @param \Illuminate\Database\Eloquent\Model $model
     */
    public function restore($model)
    {
        $model->restore();
    }

    /**
     * Limit to trashed entities.
     */
    public function onlyTrashed()
    {
        $this->onlyTrashed = true;
        $this->withTrashed = false;
    }

    /**
     * Return trashed entites aswell.
     */
    public function withTrashed()
    {
        $this->onlyTrashed = false;
        $this->withTrashed = true;
    }

    /**
     * {@inheritdoc}
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
    protected function newQuery()
    {
        $query = parent::newQuery();

        if ($this->onlyTrashed === true) {
            $column = $query->getQualifiedDeletedAtColumn();
            $query->newQueryWithoutScope(new SoftDeletingScope)->whereNotNull($column);
        }

        if ($this->withTrashed === true) {
            $query->newQueryWithoutScope(new SoftDeletingScope);
        }

        return $query;
    }

}

{'fraction_non_alphanumeric': 0.1342828077314344, 'fraction_numerical': 0.0013563919972872161, 'mean_word_length': 2.165236051502146, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '916767', 'n_tokens_mistral': 923, 'n_tokens_neox': 911, 'n_words': 167}