[ad_1]
This is my api which is testing in Postman. It returns value but not pagination value.
http://localhost/api/v1/projects-data //This is api
I put the route code in api.php
Route::get('all-blogs', 'Api\[email protected]');
And at last in my ApiController.php
public function getBlogs(Request $request, Blog $blog = null)
{
if ($blog != null) {
$blog = Blog::with(['tag', 'comments', 'user'])->where('slug_en', $blog->slug_en)->firstOrFail();
$blog->increment('views');
return response()->json(BlogResource::make($blog));
}
$blogs = Blog::with([
'tag', 'comments', 'user',
])->orderBy('created_at', 'desc')->paginate(5);
return response()->json(BlogResource::collection($blogs));
}
Every Thing working when i put paginate(5). it’s return 5 data in Postman. But Not return other information like current_page , first_page and so on is not showing.
[ad_2]