aschelch/cakephp-readable-behavior 问题修复 & 功能扩展

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

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

aschelch/cakephp-readable-behavior

Composer 安装命令:

composer require aschelch/cakephp-readable-behavior

包简介

CakePHP ReadableBehavior provides a simple behavior to make a 'Mark as Read/Unread' feature for your models

README 文档

README

CakePHP ReadableBehavior provides a simple behavior to make a "Mark as Read/Unread" feature for your models

Installation

Download the plugin

cd app/Plugin
git clone git://github.com/aschelch/cakephp-readable-behavior.git Readable

Attach the Readable behavior to the model

public Post extends AppModel{
	$actsAs = array('Readable.Readable');
}

Add a 'read' boolean column in your table or change the default field name

public Post extends AppModel{
	$actsAs = array('Readable.Readable' => array(
		'field' => 'displayed'
	));
}

Usage

Mark a post as read using id

$this->Post->markAsRead(1);

Mark multiple posts as read using a array of id

$this->Post->markAsRead(array(1,2,3));

Mark a post as unread using id

$this->Post->markAsUnread(1);

Mark multiple posts as unread using a array of id

$this->Post->markAsUnread(array(1,2,3));

Mark all posts using a condition as read

$this->Post->markAllAsRead(array('Post.user_id'=>1));

Mark all posts using a condition as unread

$this->Post->markAllAsUnread(array('Post.user_id'=>1));

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固