Oct 17, 2017
0
Level 1
Lumen fractal Include and pagination
Hello,
I try to create a fractal user include and pagination. The include is working fine but the pagination not. Maybe someone can help me with this problem.
The method to paginate all results of Article:
public function getAll()
{
$articles = Article::paginate(3);
return $articles;
}
The method to return the right response
public function index(Manager $fractal)
{
$articles = $this->articlesRepository->getAll();
$articles = $articles->getCollection();
$resource = new Collection($articles, new ArticleTransformer);
$fractal->parseIncludes('user');
return response()->json(
$fractal->createData($resource)->toArray()
);
}
I only get the result without pagination. Thank you
Please or to participate in this conversation.