title: Laravel 5 pivot table update
body: <p>I have many to many relationship between podkategorija and artikal tables and pivot table artikal_podkategorija. Inserting works fine but i don't have idea how to update data in pivot table. I trying to update artikal data and to update pivot table data artikal_id which is selected from selectform.</p>
  
  <p>PIVOT TABLE</p>
  
  <pre><code>Schema::create('artikal_podkategorija', function(Blueprint $table){
              $table-&gt;increments('id');
              $table-&gt;integer('artikal_id')-&gt;unsigned()-&gt;index();
              $table-&gt;foreign('artikal_id')-&gt;references('id')-&gt;on('artikli')-&gt;onDelete('cascade');
  
              $table-&gt;integer('podkategorija_id')-&gt;unsigned()-&gt;index();
              $table-&gt;foreign('podkategorija_id')-&gt;references('id')-&gt;on('podkategorije')-&gt;onDelete('cascade');
  
              $table-&gt;timestamps();
      }); 
  </code></pre>
  
  <p>Edit view</p>
  
  <pre><code>    {!! Form::model($artikal, ['method' =&gt; 'PATCH' , 'action' =&gt; ['ArtikliController@update', $artikal-&gt;id]]) !!}
  &lt;div class="form-group"&gt;
      {!! Form::label('Podkategorija', 'Podkategorija:') !!}
      {!! Form::select('podkategorija_id[]', $podkategorija, null, array('class' =&gt; 'form-control','placeholder' =&gt; 'Podkategorija',)) !!}
  
  
      {!! Form::label('Naziv', 'Naziv artikla:') !!}
      {!! Form::text('Naziv', null, ['class' =&gt; 'form-control']) !!}
  &lt;/div&gt;
  
  
  &lt;div class="form-group"&gt;
      {!! Form::submit('Izmijeni podkategoriju', ['class' =&gt; 'btn btn-primary']) !!}
  &lt;/div&gt;
  
  
  {!! Form::close() !!}
  </code></pre>
  
  <p>My Controller</p>
  
  <pre><code>public function store(CreateArtikalRequest $request)
  {
  
      $article = Artikal::create($request-&gt;all());
      $article-&gt;podkategorije()-&gt;attach($request-&gt;input('podkategorija'));
  
  
      return redirect('artikli');
  }
  </code></pre>