Select category with 2 levels (category and subcategory)
<p>im creating a select categories with 2 leves, a category and subcategory, i already creting and saving the data in the database, the only thing missing is in the view page, make the select field appear how i expect, but im having some doubts in how sould it be, can someone give a hint?</p>

<p>code example:</p>

<pre><code>categories:
- id;
- name;
- parent_id;

example data:
1,  Politics, null;
2, Sports, null;
3, World, null;
4, Soccer, 2;

Final result on Input Select:
Politics
Sports
-- Soccer
World


my view:
&lt;select  name="category" id="category" class="form-control"&gt;
                                &lt;option&gt;Select...&lt;/option&gt;
                                  @foreach($categories as $category)
                                    &lt;option value="{{$category-&gt;id}}"&gt;{{$category-&gt;name}}&lt;/option&gt;

                                  @endforeach
                              &lt;/select&gt;
</code></pre>