Here's my category model:
public function products() {
return $this->hasMany('Product');
}
Then i am printing all products that each category has:
@foreach($category->products as $product)
{{ $product->title }}
@endforeach
However it prints every related product to this category. How can i use pagination in that case? I've tried to print pagination links at the bottom:
<div class="pager">
{{ $category->products()->paginate(12)->links() }}
</div>
It does print pagination links correctly, but when i change the page - content is not changing.