Level 24
What is listings? is it a relation?
If it is. Try it $category->listings()->where('published', '=', 2)->paginate(20);
1 like
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')); */
}
What is listings? is it a relation?
If it is. Try it $category->listings()->where('published', '=', 2)->paginate(20);
Please or to participate in this conversation.