title: Items Filtering
body: <p>Am trying to make a eCommorece project and I want to add filter dropmenues on the products table, to search from more than one database, but everytime I select an option I get this error below...</p>
  <p><strong><a href="https://flareapp.io/share/v5pzQz2P" rel="nofollow noreferrer">https://flareapp.io/share/v5pzQz2P</a></strong></p>
  <p>And here is the conde on the controller</p>
  <pre><code>$products = Product::orderBy('id', 'desc')
          -&gt;where( function($query) use($request){
              return $request-&gt;status_id ?
                  $query-&gt;from('products')-&gt;where('status',$request-&gt;status_id) : '';})
          -&gt;where( function($query) use($request){
              return $request-&gt;category_id ?
                  $query-&gt;from('product_categories')-&gt;where('category_id',$request-&gt;category_id) : '';})
          -&gt;paginate(30);
          
          $selected_id = [];
          $selected_id['status_id'] = $request-&gt;status_id;
          $selected_id['category_id'] = $request-&gt;category_id;
  
          return view('dashboard.products.index', compact('products', 'selected_id'), $data);
  </code></pre>
  <p>My blade view</p>
  <pre><code>form class=&quot;col-sm-5 px-2&quot; action=&quot;{{ route('products.index') }}&quot; method=&quot;GET&quot;&gt;
                  @csrf
                  &lt;select class=&quot;form-select form-select-sm&quot; name=&quot;status_id&quot; aria-label=&quot;Bulk actions&quot; onchange=&quot;this.form.submit()&quot;&gt;
                    &lt;option value=&quot;0&quot; {{ $selected_id['status_id'] == '0' ? 'selected' : '' }}&gt;All Products&lt;/option&gt;
                    &lt;option value=&quot;00&quot; {{ $selected_id['status_id'] == '00' ? 'selected' : '' }}&gt;Disabled Products&lt;/option&gt;
                    &lt;option value=&quot;1&quot; {{ $selected_id['status_id'] == '1' ? 'selected' : '' }}&gt;Enabled Products&lt;/option&gt;
                  &lt;/select&gt;
                &lt;/form&gt;
                &lt;form class=&quot;col-sm-5&quot; action=&quot;{{ route('products.index') }}&quot; method=&quot;GET&quot;&gt;
                  @csrf
                  &lt;select class=&quot;form-select form-select-sm&quot; name=&quot;category_id&quot; aria-label=&quot;Bulk actions&quot; onchange=&quot;this.form.submit()&quot;&gt;
                    &lt;option value=&quot;0&quot; {{ $selected_id['category_id'] == '0' ? 'selected' : '' }}&gt;All Products&lt;/option&gt;
                    &lt;option value=&quot;1&quot; {{ $selected_id['category_id'] == '1' ? 'selected' : '' }}&gt;11223123&lt;/option&gt;
                  &lt;/select&gt;
                &lt;/form&gt;
  </code></pre>