定制 peyman-manteali/likeable 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

peyman-manteali/likeable

Composer 安装命令:

composer require peyman-manteali/likeable

包简介

implementation likeable service for laravel project

README 文档

README

for laravel 8.x or above

Installation

Use the package manager composer to install Likeable.

composer require peyman-manteali/likeable

Run the migrations

php artisan migrate

Usage

class Post extends Model
{
    use PeymanManteali\Likeable
}

Methods

    $post->likes(); 
    // Collection (Illuminate\Database\Eloquent\Collection)
    // of existing likes and dislikes for this post.

    $post->like(); // like the post for current user.
    $post->dislike(); // dislike the post for current user.
    
    $post->removeLike(); // remove like from this post for current user.
    $post->removeDislike(); // remove dislike from this post for current user.
    
    $post->isLiked(); // check if current user liked the post.
    $post->isDisliked(); // check if current user disliked the post.
    
    $post->likeCount; // get Total count of likes.
    $post->dislikeCount; // get Total count of dislikes.
    
    Post::likedBy($userId) // find only posts where user liked them.
    Post::dislikedBy($userId) // find only posts where user disliked them.
    

License [MIT](https://choosealicense.com/licenses/mit/)

Developed by Peyman Manteali

payman.manteali@gmail.com

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-15