<?php

namespace App\Facades;

use App\Models\PostLike;

class GetPostLikes
{
  public static function getPostLikeCount($postId, $likerEmail)
  {
    $LikeInfo = "";
    $result4 = PostLike::where([['post_id', $postId], ['liker_email', $likerEmail]])->get();
    if (count($result4) > 0) {
      foreach ($result4 as $roww) {
        $LikeInfo = $roww["like_unlike"];
      }
    }

    return $LikeInfo;
  }


  public static function getPostLikeCountValue($userEmail)
  {
    $likeCount = PostLike::where('post_id', '=', $userEmail)->get();
    $likeCcount = $likeCount->count();
    $linkeCC = 0;
    $showK = FALSE;
    if ($likeCcount > 1000) {
      $showK = TRUE;
      $moduleValue = $likeCcount % 100;
      $fristValue = $likeCcount / 100;
      $linkeCC = $fristValue . '.' . $moduleValue . 'K';
    } else {
      $linkeCC = $likeCcount . '';
    }
    return $linkeCC;
  }




}

?>