racashmoney/laravel-blockable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

racashmoney/laravel-blockable

Composer 安装命令:

composer require racashmoney/laravel-blockable

包简介

Trait for Laravel Eloquent models to allow easy implementation of a 'block' or 'ignore' feature.

README 文档

README

Build Status Latest Stable Version License

Trait for Laravel Eloquent models to allow easy implementation of a "block" or "ignore" feature.

Laravel 5 Documentation

Composer Install (for Laravel 5)

composer require racashmoney/laravel-blockable "~2.0"

Install and then run the migrations

'providers' => [
	\Racashmoney\Blockable\BlockableServiceProvider::class,
],
php artisan vendor:publish --provider="Racashmoney\Blockable\BlockableServiceProvider" --tag=migrations
php artisan migrate

Setup your models

class Article extends \Illuminate\Database\Eloquent\Model {
	use \Racashmoney\Blockable\Blockable;
}

Sample Usage

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

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

$article->blockCount; // get count of blocks

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

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

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

Credits

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 46
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固