Source of file VoteExtension.php
Size: 0,601 Bytes - Last Modified: 2021-12-23T10:09:13+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/VoteExtension.php
12345678910111213141516171819202122232425262728293031323334 | <?php class VoteExtension extends DataExtension { /** * @var array */ private static $has_many = [ 'Votes' => 'Vote' ]; /** * Helper function that gets the number of likes on a given Page. * * @return int|null */ public function getLikeCount() { $votes = $this->owner->Votes(); if ($votes->count()) { return $votes ->filter([ 'Status' => 'Like', 'CommentID' => '0' ]) ->count(); } return null; } } |