I would like to paginate the following relationship (a Category having many Apps):
class Category extends Model
{
Have you tried this?
$category = Category::first();
$apps = $category->apps()->paginate(10);
return view('example', compact('category', 'apps'));
Then, on your view, you can just loop through the apps.
@foreach ($apps as $app)
{{ $app->id }}
@endforeach
{!! $apps->render() !!}
If you want to set it as a relationship to category, you can use the setRelation method:
$category = Category::first();
$category->setRelation('apps', $category->apps()->paginate(10));
return view('example', compact('category');
Then in your view:
@foreach ($category->apps as $app)
{{ $app->id }}
@endforeach
{!! $category->apps->render() !!}