title: using Laravel array data in Alpine x-data directive
body: <p>I have a Laravel array that I want to use in an Alpine.js component:</p>
  <pre><code> $array = Names::get('name')-&gt;pluck('name')-&gt;toArray();
  </code></pre>
  <p>this stores the following data and sends it to the view:</p>
  <pre><code>array(3) { [0]=&gt; string(3) &quot;Foo&quot; [1]=&gt; string(3) &quot;Bar&quot; [2]=&gt; string(3) &quot;Baz&quot; } 
  </code></pre>
  <p>my alpine component has the directive x-data (I am using the search example from the Getting Started page):</p>
  <pre><code> x-data=&quot;{
      search: '',
  
      items: ['foo', 'bar', 'baz'],
  
      get filteredItems() {
          return this.items.filter(
              i =&gt; i.startsWith(this.search)
          )
      }
  }&quot;
  </code></pre>
  <p>I need to insert the data from $array to the x-data directive like this:</p>
  <pre><code>items: $array
  </code></pre>
  <p>however this is not displaying the data</p>
  <p>I can't use the blade {{ }} as that will not echo an array</p>