title: Laravel attach() method not working to hasMany side
body: <p>The application has the models:</p>
  
  <h3>Atividade.php</h3>
  
  <pre class="lang-php prettyprint-override"><code>class Atividade extends Eloquent {
      public function intervencoes() {
          return $this-&gt;belongsToMany('Intervencao');
      }
  }
  </code></pre>
  
  <p><br/></p>
  
  <h3>Intervencao.php</h3>
  
  <pre class="lang-php prettyprint-override"><code>class Intervencao extends Eloquent {
      public function atividades() {
          return $this-&gt;hasMany('Atividade');
      }
  }
  </code></pre>
  
  <p><br/></p>
  
  <p>The following code works:</p>
  
  <pre class="lang-php prettyprint-override"><code>Atividade::find($id)-&gt;intervencoes()-&gt;attach($intervencao_id);
  </code></pre>
  
  <p>But, this...</p>
  
  <pre class="lang-php prettyprint-override"><code>Intervencao::find($id)-&gt;atividades()-&gt;attach($atividade_id);
  </code></pre>
  
  <p>Returns an BadMethodCallException:</p>
  
  <blockquote>
    <p>Call to undefined method Illuminate\Database\Query\Builder::attach()</p>
  </blockquote>
  
  <p><br/></p>
  
  <h3>SOLUTION (thanks to @gnack):</h3>
  
  <p>I was trying to set a many-to-many relationship, so just needed to change this...</p>
  
  <pre class="lang-php prettyprint-override"><code>return $this-&gt;hasMany('Atividade');
  </code></pre>
  
  <p>To this:</p>
  
  <pre class="lang-php prettyprint-override"><code>return $this-&gt;belongsToMany('Atividade');
  </code></pre>