title: create dropdown list from database in laravel via controller
body: <p>I want to create a dropdown from the database, but the result is still an object. how to make the dropdown filled with an array of tables</p>
  <p>my controller</p>
  <pre><code>public function edit($id)
      {
          $complain = new Complain();
          $data = $complain-&gt;findData($id);
  
          $user = User::select('id','name')-&gt;where('role_id', '=', 3, 'and')-&gt;where('type_id', '=', 3)-&gt;get();
  
          $html = '&lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;ticket&quot;&gt;No Ticket:&lt;/label&gt;
                      &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;ticket&quot; id=&quot;editTicket&quot; value=&quot;' . $data-&gt;ticket . '&quot; disabled&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;complain&quot;&gt;Complain Detail:&lt;/label&gt;
                      &lt;textarea class=&quot;form-control&quot; name=&quot;complain&quot; id=&quot;editComplain&quot; disabled&gt;' . $data-&gt;complain . '
                      &lt;/textarea&gt;
                  &lt;/div&gt;
                 &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;name&quot;&gt;Name:&lt;/label&gt;
                      &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;name&quot; id=&quot;editName&quot; value=&quot;' . $data-&gt;name . '&quot; disabled&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;kartu&quot;&gt;Card Number:&lt;/label&gt;
                      &lt;input type=&quot;text&quot; class=&quot;form-control&quot; name=&quot;kartu&quot; id=&quot;editKartu&quot; value=&quot;' . $data-&gt;kartu . '&quot; disabled&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label for=&quot;pic_id&quot;&gt;Assign To:&lt;/label&gt;
                  &lt;select name=&quot;pic_id&quot; id=&quot;editPICId&quot;&gt;
                  &lt;option&gt;'.$user.'&lt;/option&gt;
                  &lt;/select&gt;
                  &lt;/div&gt;';
          return response()-&gt;json(['html' =&gt; $html]);
      }
  </code></pre>
  <p>and the results I get are <code>[{&quot;id&quot;: 1}, {&quot;id&quot;: 2}, {&quot;id&quot;: 3}]</code>. how to convert that data into a dropdown list ?</p>