The Laravel team released Laravel 5. 8.8 yesterday with a new query builder method along with the latest fixes and changes in the 5.8 branch.
First, a new Builder::forPageBeforeId() method was added to compliment an existing forPageAfterId().
These methods are useful to query for records before or after a given record. In the pull request author Tim MacDonald illustrates the following example to get the records around a “focused” post:
$posts = new Collection;
$posts = $posts->concat(ChatPost::forPageBeforeId(15, $focused->id)->get()->reverse());
$posts = $posts->push($focused);
$posts = $posts->concat(ChatPost::forPageAfterId(15, $focused->id)->get());
You can see the full list of fixes below, and the whole difference between 5.8.7 and 5.8.8 on GitHub.
The full release notes for Laravel 5.8 are available in the GitHub 5.8 changelog:
Added Added Illuminate\Database\Query\Builder::forPageBeforeId() method (#28011)
BelongsToMany::detach() with custom pivot class (#27997)
Fixed incorrect event namespace in generated listener by event:generate command (#28007)
Fixed unique validation without ignored column (#27987)
Added parameters argument to resolve helper (#28020) Don’t add the path only if path is empty in compiled view (#27976)
Refactoring of env() helper (#27965)