I'm trying to get result from query using paginate and in view using code below i reduce the code to make it accepted $categories=Course_category::has('classe')->paginate(2);
@foreach ($categories as $categorie)
@foreach ($categorie->classe as $item )
@endforeach
@endforeach
{{ $categories->links('pagination::bootstrap-4') }}
Can you try something like this:
$categories = Course_category::with(['classe' => function ($q) {
$q->paginate(2);
//or something like $q->orderBy(stuff)->take(2);
}]);