Team-Tea-Time / laravel-forum

A slim, lean forum package designed for quick and easy integration in Laravel projects
https://laravel-forum.teamteatime.net/
MIT License
601 stars 165 forks source link

Changing the order of posts + double paginations #185

Closed Datalink-Wouter closed 6 years ago

Datalink-Wouter commented 6 years ago

Hi,

  1. There is no option to change the order of "reactions"? I mean, if we want to show the most recent reactions on top, the initial topic will be placed at last. The thread-page is just a list of all post, and there is no difference between the initial post and the reactions. Am I correct or am I missing something here?

So changing the posts() method in the Thread model: from $query = $this->hasMany(Post::class); to $query = $this->hasMany(Post::class)->orderBy('created_at','DESC'); will put the initial post as last post.

  1. Is it possible to add a second pagination list at the top of a thread? The pagination is not loaded inside a view?

Kind regards, Wouter

Riari commented 6 years ago

Hi, sorry for the late response.

On your first point, you're right, there is currently no way to override ordering of posts. The way posts are ordered and presented matches the behaviour most other forums. If you really want to change this, with laravel-forum-frontend, you can extend the ThreadController class and override the show method, then update your config (see https://teamteatime.net/docs/laravel-forum/4.x/front-end.configuration.md).

As for pagination, it's not obvious, but this line is what renders the pagination links. Just override the view and use that line somewhere near the top as well.