File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 2121 * @property Carbon $created_at
2222 * @property Carbon $updated_at
2323 * @property int $comments_count
24+ * @property int $likes_count
2425 * @property User $author
2526 */
2627final class Tweet extends Model
@@ -90,6 +91,11 @@ public function getCommentsCount(): int
9091 return (int )$ this ->comments_count ;
9192 }
9293
94+ public function getLikesCount (): int
95+ {
96+ return (int )$ this ->likes_count ;
97+ }
98+
9399 public function changeContent (string $ text ): void
94100 {
95101 if (empty ($ text )) {
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ public function present(Tweet $tweet): array
2626 'image_url ' => $ tweet ->getImageUrl (),
2727 'created_at ' => $ tweet ->getCreatedAt ()->toDateTimeString (),
2828 'author ' => $ this ->userPresenter ->present ($ tweet ->getAuthor ()),
29- 'comments_count ' => $ tweet ->getCommentsCount ()
29+ 'comments_count ' => $ tweet ->getCommentsCount (),
30+ 'likes_count ' => $ tweet ->getLikesCount ()
3031 ];
3132 }
3233
You can’t perform that action at this time.
0 commit comments