I want to show pagination on my page based on the data from the resource collection.
I have done this code for get data in collection and paginate.
return auth()->user()->hasRole('admin')
? ArticleResource::collection(Article::latest()->paginate(5))
: ArticleResource::collection(auth()->user()->articles()->latest()->paginate(5));
2
Answers
First, create a collection class that will extend the bascollection class
}
Than you can use in controller like this
l
this is how i am using
In the blade file, you just have to do this
{{$portal->links()}}