This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/app/models/Post/CommentMethods.php

14 lines
382 B
PHP
Raw Normal View History

2013-10-27 01:06:58 +02:00
<?php
trait PostCommentMethods
{
public function recent_comments()
{
$recent = new Rails\ActiveRecord\Collection();
# reverse_order to fetch last 6 comments
# reversed in the last to return from lowest id
if ($this->comments) {
$recent->merge(array_slice($this->comments->members(), -6));
}
return $recent;
}
}