title: laravel - backpack - addFilter custom query
body: <p>How to create function to show result in list? - Backpack</p>
  
  <p>This code return error
  {message: "Call to a member function count() on array", exception: "Error",…}
  exception: "Error"
  file: "location/crm/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Query.php"
  line: 144
  message: "Call to a member function count() on array"
  trace: [,…]</p>
  
  <pre><code> $this-&gt;crud-&gt;addFilter([ // select2 filter
          'name' =&gt; 'version',
          'type' =&gt; 'select2',
          'label'=&gt; 'Status'
        ], function() {
            return [
              'something1' =&gt; 'something1',
              'something2' =&gt; 'something2',
          ];
        }, function($value) {
          //dump($this-&gt;crud);
          $query = DB::select("SELECT s.system_id FROM(
              SELECT s.id as system_id, (SELECT max(id) FROM licenses l WHERE s.id = l.system_id) as license_id FROM systems s
          ) s LEFT JOIN licenses l ON l.id = s.license_id WHERE l.version= '$value' ORDER BY s.system_id");
  
  
  
          return $this-&gt;crud-&gt;query = $query;
        });
  </code></pre>