title: How to insert a post with multi category and with multi column deferent category in laravel?
body: <p>Hello all I am a new laravel, I have problem with my project. I have 2 table:</p>
  
  <pre><code>posts: id title category_id
  category: id name(PHP, Laravel, Ruby)
  </code></pre>
  
  <p>Ex:I want result like, if I am insert a post into posts database title=Jonh and chosse two category name(PHP,Laravel), and the result will two column like  posts(id=1 title(jonh) category_id(1), id=2 title(jonh) category_id(2)) but it still not work I try to find in google and youtube follow and it not work, and here is my code:</p>
  
  <pre><code>View(create.blade.php)
  {!!Form::open(array('route' =&gt; 'store', 'method' =&gt; 'POST'))!!}
  
  {{Form::text('title')}}&lt;br&gt;
  
  @foreach($category as $categories)
  {{Form::label('category',$categories-&gt;name)}}
  {{Form::checkbox('category_id', $categories-&gt;id) }}
  @endforeach
  &lt;br&gt;
  {{Form::submit('submit')}}
  {!!Form::close()!!}
  
  Controller(PostsController.php)
  public function create()
      {
          $category = Category::all();
          return view('create',compact('category'));
      }
      public function store(Request $request)
      {
         $post = new Posts;
         $post-&gt;title = $request['title'];
         $post-&gt;category_id = $request['category_id'];
         $post-&gt;save();
      }
  </code></pre>
  
  <p>Help pls</p>