mirror of
https://github.com/flarum/core.git
synced 2025-08-10 18:35:56 +02:00
Use Eloquent's latest
and oldest
This commit is contained in:
@@ -223,7 +223,7 @@ class Discussion extends AbstractModel
|
||||
public function refreshLastPost()
|
||||
{
|
||||
/** @var Post $lastPost */
|
||||
if ($lastPost = $this->comments()->latest('created_at')->first()) {
|
||||
if ($lastPost = $this->comments()->latest()->first()) {
|
||||
$this->setLastPost($lastPost);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ class Discussion extends AbstractModel
|
||||
*/
|
||||
public function mergePost(MergeableInterface $post)
|
||||
{
|
||||
$lastPost = $this->posts()->latest('created_at')->first();
|
||||
$lastPost = $this->posts()->latest()->first();
|
||||
|
||||
$post = $post->saveAfter($lastPost);
|
||||
|
||||
|
Reference in New Issue
Block a user