title: laravel 4 paginate collection
body: <p>I cant create a proper pagination system using laravel 4. I have the following models and function that return collections:</p>
  
  <p>Model Restaurant:</p>
  
  <pre><code>public function fooditem()
  {
      return $this-&gt;hasMany('Fooditem','rest_id');
  }
  public function get_rest_foods($id){
      return Restaurant::find($id)-&gt;fooditem-&gt;toArray();
  }
  </code></pre>
  
  <p>The second function returns all food items for a certain restaurant as an array. I also use this in an API call.</p>
  
  <p>in my controller i have this:   </p>
  
  <pre><code> $food = $food-&gt;get_rest_foods($id);
   $paginator = Paginator::make($food, 10, 5);
  </code></pre>
  
  <p>I pass the paginator to the view and it shows the links ok but also shows all my item from the food array.</p>
  
  <p>I tried using </p>
  
  <pre><code>public function get_rest_foods($id){
          return Restaurant::find($id)-&gt;fooditem-&gt;paginate(5);
      }
  </code></pre>
  
  <p>but i get an error: </p>
  
  <blockquote>
    <p>FatalErrorException: Error: Call to undefined method Illuminate\Database\Eloquent\Collection::paginate()</p>
  </blockquote>
  
  <p>I searched this and many other sites but cant understant how to paginate a collection.</p>
  
  <p>Thanks for your help</p>