Skip to content

Commit

Permalink
Add time order & pagination for posts list
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilg4mesh committed Nov 28, 2018
1 parent e450b83 commit 21a5a94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ Then you can login to your admin panel from `http://yourdomain.com/admin` using
2. Add Clean Blog routes & remove unused routes
3. Clean up templates
4. Simple posts list and single-post route based on Voyager posts
5. Single post page
5. Single post page
6. Add time order & pagination for posts list
2 changes: 1 addition & 1 deletion resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@

<!-- Pager -->
<div class="clearfix">
<a class="btn btn-primary float-right" href="#">Older Posts &rarr;</a>
{{ $posts->links() }}
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


Route::get('/', function () {
$posts = \DB::table('posts')->get();
$posts = \DB::table('posts')->orderBy('created_at', 'desc')->paginate(3); // 3 items in one page
return view('index', compact(['posts']));
});

Expand Down

0 comments on commit 21a5a94

Please sign in to comment.