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
2013-10-26 18:06:58 -05:00

14 lines
382 B
PHP
Executable File

<?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;
}
}