title: How resolve BadMethodCallException, Call to undefined method Illuminate\Database\Query\Builder::filter()
body: <p>I'm trying to filter the results from eloquent query, but appear the next error <code>BadMethodCallException</code>. According to me, I'm doing everything right.</p>
  
  <p>I'm using Laravel 5.4</p>
  
  <p>The error details:</p>
  
  <pre><code>BadMethodCallException
  Call to undefined method Illuminate\Database\Query\Builder::filter()
  in Builder.php line 2445
  at Builder-&gt;__call('filter', array(null))
  in Builder.php line 1254
  at Builder-&gt;__call('filter', array(null))
  in web.php line 459
  at Router-&gt;{closure}()
  in Route.php line 189
  at Route-&gt;runCallable()
  in Route.php line 163
  at Route-&gt;run()
  in Router.php line 572
  </code></pre>
  
  <p>I have the next code:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function index(SearchRequest $searchRequest, ConfigurationFilter $filters)
      {
          $filtered_configurations = Configuration::whereTrash(false)-&gt;with(['customs.properties', 'properties'])-&gt;filter($filters);
  
          $types = $this-&gt;getConfigurationTypes();
          $authors = $this-&gt;getAuthors();
  
          return view('configuration.assistant.index', [
              'configurations' =&gt; $filtered_configurations-&gt;paginate(10),
              'authors' =&gt; $authors,
              'types' =&gt; $types,
          ]);
      }
  
  </code></pre>
  
  <p>Where <code>SearchRequest</code> is:</p>
  
  <pre class="lang-php prettyprint-override"><code>class SearchRequest extends FormRequest {
  
      /**
       * Determine if the user is authorized to make this request.
       *
       * @return bool
       */
      public function authorize()
      {
          return Auth::user()-&gt;author != null;
      }
  
      /**
       * Get the validation rules that apply to the request.
       *
       * @return array
       */
      public function rules()
      {
          return [
              //
          ];
      }
  }
  </code></pre>
  
  <p>Where <code>ConfigurationFilter</code> is:</p>
  
  <pre class="lang-php prettyprint-override"><code>class ConfigurationFilter extends ModelFilter
  {
      public function name($value)
      {
          return $this-&gt;builder-&gt;where('name', 'like', "%{$value}%");
      }
  
      public function author($id)
      {
          return $this-&gt;builder-&gt;whereIn('user_id', explode(',', $id));
      }
  
      public function type($type)
      {
          return $this-&gt;builder-&gt;whereIn('category_id', explode(',', $type));
      }
  
      public function status($status)
      {
          return $this-&gt;builder-&gt;whereEnabled($status == 'enabled');
      }
  }
  </code></pre>
  
  <p>Where <code>ModelFilter</code> is:</p>
  
  <pre class="lang-php prettyprint-override"><code>class ModelFilter extends QueryFilter implements Filter
  {
      public function id($id)
      {
          return $this-&gt;builder-&gt;whereIn('id', explode(',', $id));
      }
  
      public function from($date)
      {
          return $this-&gt;builder-&gt;where('created_at', '&gt;=', $date);
      }
  
      public function to($date)
      {
          return $this-&gt;builder-&gt;where('created_at', '&lt;=', $date);
      }
  
      public function enabled($status)
      {
          return $this-&gt;builder-&gt;whereEnabled($status === 'true');
      }
  
      public function trash($status)
      {
          return $this-&gt;builder-&gt;whereTrash($status === 'true');
      }
  
      public function take($limit = 100)
      {
          return $this-&gt;builder-&gt;take($limit);
      }
  }
  
  </code></pre>
  
  <p>Where <code>Filter</code> is:</p>
  
  <pre class="lang-php prettyprint-override"><code>interface Filter {
  
      public function id($id);
  
      public function from($date);
  
      public function to($date);
  
      public function enabled($status);
  
      public function trash($status);
  
      public function take($limit = 100);
  }
  
  </code></pre>
  
  <p>What will I be missing?</p>
  
  <p>Thanks in advance</p>