title: How to filter a array with Laravel Livewire?
body: <p>I have a simple Livewire component, like the following</p>
  <pre><code>use Livewire\Component;
  
  class KandidaatList extends Component
  {
      public $kandidaten = [];
  
      public function mount()
      {
          $this-&gt;kandidaten = '[
          {
            &quot;naam&quot; : &quot;Aad Elias&quot;,
            &quot;geslacht&quot;: &quot;m&quot;,
            &quot;leeftijd&quot;: &quot;35&quot;,
            &quot;woonplaats&quot;: &quot;Groningen&quot;,
          },
          {
            &quot;naam&quot; : &quot;Linda de Jong&quot;,
            &quot;geslacht&quot;: &quot;v&quot;,
            &quot;leeftijd&quot;: &quot;24&quot;,
            &quot;woonplaats&quot;: &quot;Mantgum&quot;,
          }
        ]';
      }
  }
  </code></pre>
  <p><strong>Blade/View</strong></p>
  <pre><code>&lt;div&gt;
      @foreach (json_decode($kandidaten) as $kandidaat)
        &lt;div class=&quot;pl-14 py-5 border-b border-grey-600 flex justify-around&quot;&gt;
          &lt;div&gt;{{$kandidaat-&gt;naam}}&lt;/div&gt;
          &lt;div&gt;{{$kandidaat-&gt;leeftijd}}&lt;/div&gt;
          &lt;div&gt;{{$kandidaat-&gt;woonplaats}}&lt;/div&gt;
          &lt;div class=&quot;c-tag c-tag--primary h-5&quot;&gt;{{$kandidaat-&gt;status}}&lt;/div&gt;
        &lt;/div&gt;
      @endforeach
  &lt;/div&gt;
  </code></pre>
  <p>Now I would like to add a feature so I can filter through the array. For example, if I would type in the name <code>Aad Elias</code> that only results with that name show up.</p>
  <p>I've generated a component that holds a search query, like the following.</p>
  <pre><code>namespace App\Http\Livewire;
  
  use Livewire\Component;
  
  class Search extends Component
  {
      public $query;
      
      public function mount()
      {
        $this-&gt;query = 'search query';
      }
  }
  </code></pre>
  <p>And for now, I can output the typed a query in the Blade.</p>
  <pre><code>&lt;div&gt;
      &lt;input wire:model=&quot;query&quot; type=&quot;text&quot;&gt;
      {{ $query }}
  &lt;/div&gt;
  </code></pre>
  <p>But how do I connect the query I type in this input field with the array from <code>KandidaatList</code> to return only results with the searched name?</p>