title: Laravel 5 Join table query with where clause
body: <p>Trying to achieve with Laravel 5.2's eloquent model</p>
  
  <p>I have 2 tables:</p>
  
  <p>1) projects (id, projectName, users_id)</p>
  
  <p>2) todo (id, todoName, ProjectID[id], users_id)</p>
  
  <p>i want to join these table and foreach the table content with</p>
  
  <pre><code>-&gt;where('users_id','=',Auth()-&gt;User()-&gt;id)
  </code></pre>
  
  <p>Part of the code</p>
  
  <pre><code>$todos = DB::table('to_dos')-&gt;join('projects','to_dos.projectID','=','projects.projectName')
                                                              -&gt;where('users_id','=',Auth()-&gt;User()-&gt;id)
                                                              -&gt;get();
  </code></pre>
  
  <p>the objective is to print toDoName and projectName</p>
  
  <pre><code>@foreach($todos as $todo)
      {{$todo -&gt; ToDoName}}
      {{$todo -&gt; projectName}}
      &lt;br&gt;
  @endforeach
  </code></pre>