title: How to Store Data from select html tag to DB and display it...Laravel
body: <p>Laravel</p>
  <p>I have 3 tables</p>
  <p>1- users =&gt; id + name + email + password</p>
  <p>2- categories =&gt; id + name</p>
  <p>3- category_user =&gt; user_id + category_id</p>
  <p>I want the users to choose their favorite categories so that only the articles for that category appear.</p>
  <p>here the page to select category:</p>
  <pre><code>&lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;body&quot;&gt;Category&lt;/label&gt;
          &lt;select name=&quot;categories[]&quot; id=&quot;&quot; multiple&gt;
              @foreach ($categories as $category)
              &lt;option value=&quot;{{$category-&gt;id}}&quot;&gt;{{$category-&gt;name}}&lt;/option&gt;
              @endforeach
          &lt;/select&gt;
  </code></pre>
  <p>how can I store this data in the category_user table? (with validate)</p>
  <p>Also, how can I display only articles belonging to the selected categories?</p>