Laravel 5.2 + How to save record in DB
<p>While working with laravel 5.2 since last 2 weeks, I have found one new method to store records in DB.</p>

<p>For Instance </p>

<pre><code> User table 
 id      name
 1       Test 1
 2       Test 2

 Project Table
 id     user_id      name
 1      1            Project 1
 2      2            Project 2
</code></pre>

<p><strong>User</strong> and <strong>Project</strong> table are linked in Foreign Key constraint.</p>

<p>To store in <strong>Project</strong> table, I have used below line of code.</p>

<pre><code>Auth::user()-&gt;projects()-&gt;save($project);
</code></pre>

<p>Can I have similar kind of solution if I want to store record in <strong>Task</strong> table?
Where project_id and user_id are foreign key constraints of project and user table respectively.</p>

<pre><code>Task Table 
id    project_id     user_id      name
1     1              1            test task
</code></pre>