承接 shubhang/laravel-dislikeable 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

shubhang/laravel-dislikeable

Composer 安装命令:

composer require shubhang/laravel-dislikeable

包简介

Trait for Laravel Eloquent models to allow easy implementation of a 'dislike' feature.

README 文档

README

Trait for Laravel Eloquent models to allow easy implementation of a "Dislike" feature.

Composer Install (for Laravel 5)

composer require shubhang-arora/laravel-dislikeable "~1.0"

Install and then run the migrations

'providers' => array(
	 Shubhang\DisLikeable\DisLikeableServiceProvider::class,
);
php artisan vendor:publish --provider="Shubhang\DisLikeable\DisLikeableServiceProvider"
php artisan migrate

Setup your models

class Article extends \Illuminate\Database\Eloquent\Model {
	use Shubhang\DisLikeable\DisLikeableTrait;
}

Sample Usage

$article->dislike(); // dislike the article for current user
$article->dislike($myUserId); // pass in your own user id
$article->dislike(0); // just add dislikes to the count, and don't track by user

$article->undislike(); // remove dislike from the article
$article->undislike($myUserId); // pass in your own user id
$article->undislike(0); // remove dislikes from the count -- does not check for user

$article->dislikeCount; // get count of dislikes

$article->dislikes; // Iterable Illuminate\Database\Eloquent\Collection of existing dislikes

$article->disliked(); // check if currently logged in user disliked the article
$article->disliked($myUserId);

Article::whereDisLiked($myUserId) // find only articles where user disliked them
	->with('dislikeCounter') // highly suggested to allow eager load
	->get();

Credits

  • Shubhang Arora

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固