title: How to use Laravel Pagination with models relationsips?
body: <p>I have categories and items tables. Each item belongs to only one category and each category has many items. So, in Category model I defined this relationship:</p>
  
  <pre><code>public function items()
  { return $this-&gt;hasMany('Item', 'catid'); }
  </code></pre>
  
  <p>and I retrieve data for a category this way:</p>
  
  <pre><code>$category = Category::find($id);
  return View::make('admin.categories.catdetails')-&gt;with('category', $category);
  </code></pre>
  
  <p>and in my view I can loop through data:</p>
  
  <pre><code> @foreach ($category-&gt;items as $item)
          &lt;tr&gt;          
              &lt;td&gt; {{ $item-&gt;name }}  &lt;/td&gt; 
              &lt;td&gt; {{number_format($item-&gt;price, 2, '.', '')}} &lt;/td&gt;
          &lt;/tr&gt;
      @endforeach
  </code></pre>
  
  <p>but this results in all items in on page. How to make use of laravel pagination in case that I have so many items for one page??
  How can I use </p>
  
  <pre><code>::paginate() // in controller or model
  -&gt;links() // in view
  </code></pre>
  
  <p>as, so far, it throws many errors and I can't figure it out.
  Thanks in advance.</p>