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