承接 batuhan/laravel-flaggable 相关项目开发

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

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

batuhan/laravel-flaggable

最新稳定版本:1.0.0

Composer 安装命令:

composer require batuhan/laravel-flaggable

包简介

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

README 文档

README

Build Status Latest Stable Version License

Trait for Laravel Eloquent models to allow easy implementation of a "flag" feature. Only tested with Laravel 5.

Composer Install (for Laravel 5)

composer require batuhan/laravel-flagable "~1.0.0"

Install and then run the migrations

'providers' => array(
	'Conner\Likeable\LikeableServiceProvider',
);
php artisan vendor:publish --provider="Conner\Likeable\LikeableServiceProvider"
php artisan migrate

Setup your models

class Article extends \Illuminate\Database\Eloquent\Model {
	use Conner\Likeable\LikeableTrait;
}

Sample Usage

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

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

$article->flagCount; // get count of flags

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

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

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

Credits

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-23