i have 2 model
category model and topics model
category has many topics and while i get the category relation (topics) pagination it works good but how to get the pagination links ?
this is my code and it works well
$category->load([ 'topics' => function($query){
return $query->paginate(2);
}]);
but this is not workin :(
$category->topics()->links()
// Try This
$topics = $category->topics()->paginate(2);
// to show the links
{{ $topics->links() }}
// OR i'm not sure with eager load || U have to refrance realtionship in $var
$topics = $category->load([ 'topics' => function($query){
return $query->paginate(2);
}]);
// to show the links
{{ $topics->links() }}