From a3fce82bfe2b3bf60e55c0ab0e10ef903ae4b2bf Mon Sep 17 00:00:00 2001 From: TZGyn Date: Sun, 16 Jul 2023 08:24:34 +0800 Subject: [PATCH] Added like count to posts --- .../2023_06_05_145153_create_posts_table.php | 1 + frontend/components/PostCard.vue | 85 ++++++++++++++++--- frontend/composables/post.ts | 1 + 3 files changed, 74 insertions(+), 13 deletions(-) diff --git a/backend/database/migrations/2023_06_05_145153_create_posts_table.php b/backend/database/migrations/2023_06_05_145153_create_posts_table.php index cae97c2..7d9336b 100644 --- a/backend/database/migrations/2023_06_05_145153_create_posts_table.php +++ b/backend/database/migrations/2023_06_05_145153_create_posts_table.php @@ -16,6 +16,7 @@ return new class extends Migration $table->uuid('id'); $table->foreignUuid('user_id')->constrained(table: 'users', column: 'id'); $table->longText('description')->nullable(true); + $table->integer('like_count')->default(0); $table->timestamps(); }); } diff --git a/frontend/components/PostCard.vue b/frontend/components/PostCard.vue index 59947de..2843696 100644 --- a/frontend/components/PostCard.vue +++ b/frontend/components/PostCard.vue @@ -1,45 +1,104 @@