title: Laravel's Eager Loading is bringing all data from database
body: <p>I have a <code>Post</code> model that belongs to a <code>Category</code> model. I also have an index page that lists all the <code>Post</code>s, and for each one I need to print the name of the <code>Category</code> it belongs to.</p>
  
  <pre><code>class Post extends Model
  {
      public function category()
      {
          return $this-&gt;belongsTo(Category::class);
      }
  }
  
  class Category extends Model
  {
      public function posts()
      {
          return $this-&gt;hasMany(Post::class);
      }
  }
  </code></pre>
  
  <p>My <code>PostController::index</code></p>
  
  <pre><code>public function index()
  {
      return \View::make('admin/post/index')-&gt;with([
          'posts' =&gt; \DB::table('posts')-&gt;orderBy('id', 'DESC')-&gt;get(),
          'category' =&gt; Post::with('category')-&gt;get()
      ]);
  }
  </code></pre>
  
  <p>Like this, if I echo the <code>$category</code>, it shows all registered categories inside of each row in <code>Post</code>. I don't know what I can do in the view to show the correct name of the category for each <code>Post</code>.</p>
  
  <p>I did this in my view, but like this, it only shows the <em>x</em> register of the table for every <code>Post</code>:</p>
  
  <pre><code>@foreach ($posts as $post)
      &lt;tr&gt;
          &lt;td&gt;
              &lt;a href="/admin/post/view/{{ $post-&gt;id }}"&gt;
                  {{ $post-&gt;title }}
              &lt;/a&gt;
          &lt;/td&gt;
          &lt;td&gt;
              {{ str_limit($post-&gt;content, 120) }}
          &lt;/td&gt;
          &lt;td&gt;
              {{ $category[1]-&gt;category-&gt;category }}
          &lt;/td&gt;
          &lt;td&gt;
              {{ date('m/d/Y', strtotime($post-&gt;created_at)) }}
          &lt;/td&gt;
          &lt;td&gt;
              &lt;a href="/admin/post/edit/{{ $post-&gt;id }}" class="btn btn-primary"&gt;
                  Edit
              &lt;/a&gt;
              &lt;a href="/admin/post/delete/{{ $post-&gt;id }}" class="btn btn-danger"&gt;
                  Delete
              &lt;/a&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  @endforeach
  </code></pre>
  
  <p>How do I properly print the name of the <code>Category</code>, which is related to <code>Post</code>, with Laravel 5.2 using Eager Loading?</p>