Add Postable::getLastComments

This commit is contained in:
Alma Armas 2020-08-01 14:23:08 +00:00
parent 98045ec121
commit f235338d69

View file

@ -71,6 +71,11 @@ abstract class Postable extends Attachable
return (new Comments)->getCommentsCountByTarget($this); return (new Comments)->getCommentsCountByTarget($this);
} }
function getLastComments()
{
return (new Comments)->getLastCommentsByTarget($this);
}
function getLikesCount(): int function getLikesCount(): int
{ {
return sizeof(DB::i()->getContext()->table("likes")->where([ return sizeof(DB::i()->getContext()->table("likes")->where([