Method paginate does not exist

Posted 1 year 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?



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

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