Skip to content

Commit

Permalink
share count code improve
Browse files Browse the repository at this point in the history
  • Loading branch information
spanjaan committed Aug 22, 2024
1 parent 807966b commit f8e6ec1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/BlogPortalPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function getPromotedTags(): Collection
public function getSharesCount(): int
{
// Fetch the share count record for this post
$shareCount = Sharecount::where('post_id', $this->id)->first();
$shareCount = Sharecount::where('post_id', $this->model->id)->first();

// Calculate total shares if the share count record exists, otherwise return 0
return $shareCount ? $shareCount->facebook + $shareCount->twitter + $shareCount->linkedin + $shareCount->whatsapp : 0;
Expand Down

0 comments on commit f8e6ec1

Please sign in to comment.