ChrisPercival
2 years ago

Method paginate does not exist

Posted 2 years ago by ChrisPercival

Hi All,

I am trying to add pagination to the code below. When I do I get 'Method paginate does not exist'

Can someone point out whats wrong?

Thanks

Chris

public function index(Category $category)
{
/*     $listings = ($category->listings->where('published', '=', 2)->paginate(20)); */
        $listings = ($category->listings->where('published', '=', 2));
        return($listings); 
/*    return view('listings.index', compact('listings')); */
}

Please sign in or create an account to participate in this conversation.