laravel-forum | lean forum package designed for quick and easy integration | Collaboration library
kandi X-RAY | laravel-forum Summary
kandi X-RAY | laravel-forum Summary
A slim, lean forum package designed for quick and easy integration in Laravel projects
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Register the package services .
- Generate a URL to a forum .
- Process the categories .
- List threads by category .
- Create threads in category .
- Returns an array representation of this object .
- Run the migrations .
- Filter categories .
- Show post .
- Authorize validated thread .
laravel-forum Key Features
laravel-forum Examples and Code Snippets
Community Discussions
Trending Discussions on laravel-forum
QUESTION
I recently moved a Laravel website to a different server with the same setup (slightly different versions of php, mariadb, etc.) and have run into an interesting problem.
I'm using the package Team-Tea-Time/laravel-forum (formerly riari/laravel-forum) to provide message board functionalities. In the forum every thread has a link to get to the newest post, which worked fine before the move. After the move those links lead to the oldest/first post instead.
The functionality is part of the Thread model, specifically the function getLastPostAttribute().
When trying to get to the bottom of this, I realized that the orderBy on the posts relationship is simply not having any effect. No matter what attribute I sort by (e.g. created_at, sequence) and which sort direction I request, it's always the same post order and the same first post being returned.
Example of a thread with 1811 posts with different timestamps and sequence numbers:
Ordering by sequence ASC works correctly, the first post being the one with the smalles sequence number. This is however also the default order of that relationship (see Model).
...ANSWER
Answered 2020-Dec-16 at 14:12When you look at the relation definition in the source code of Thread.php, you see that posts
are already ordered by created_at
by default:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install laravel-forum
Install the package via composer:.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page