title: Laravel save nested model
body: <p>I am using Laravel 4 and got stuck with a problem.</p>
  
  <p>I have 3 models: User, Project, Task.</p>
  
  <p>Relationships:</p>
  
  <ul>
  <li>User belongsToMany('Project')</li>
  <li>Project belongsToMany('User')</li>
  <li>Project belongsToMany('Task')</li>
  <li>Task belongsTo('Project')</li>
  </ul>
  
  <p>I want to store a task but with no luck. The following code maybe tells in more detail what I want to accomplish:</p>
  
  <pre><code>Auth::user()-&gt;projects($projectId)-&gt;tasks()-&gt;save($task);
  </code></pre>
  
  <p>With that code I get:</p>
  
  <pre><code>Call to undefined method Illuminate\Database\Query\Builder::tasks()
  </code></pre>