Skip to content

Commit

Permalink
Merge pull request #283 from alaaelgndy/1.x
Browse files Browse the repository at this point in the history
Configure the pagination to each resource
  • Loading branch information
themsaid authored Apr 28, 2023
2 parents c276383 + fb10aec commit 2fc3b68
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions config/wink.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,19 @@
'default' => null,

],

/*
|--------------------------------------------------------------------------
| The pagination of wink collections
|--------------------------------------------------------------------------
|
| You can configure here the number of items, per page.
|
*/
'pagination' => [
'posts' => 30,
'tags' => 30,
'teams' => 30,
'pages' => 30,
],
];
2 changes: 1 addition & 1 deletion src/Http/Controllers/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function index()
$q->where('title', 'LIKE', '%'.request('search').'%');
})
->orderBy('created_at', 'DESC')
->paginate(30);
->paginate(config('wink.pagination.pages', 30));

return PagesResource::collection($entries);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/PostsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function index()
})
->orderBy('created_at', 'DESC')
->with('tags')
->paginate(30);
->paginate(config('wink.pagination.posts', 30));

return PostsResource::collection($entries);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/TagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function index()
})
->orderBy('created_at', 'DESC')
->withCount('posts')
->paginate(30);
->paginate(config('wink.pagination.tags', 30));

return TagsResource::collection($entries);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/TeamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function index()
})
->orderBy('created_at', 'DESC')
->withCount('posts')
->paginate(30);
->paginate(config('wink.pagination.teams', 30));

return TeamResource::collection($entries);
}
Expand Down

0 comments on commit 2fc3b68

Please sign in to comment.