定制 andheiberg/readable 二次开发

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

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

andheiberg/readable

Composer 安装命令:

composer require andheiberg/readable

包简介

Make eloquent models readable

README 文档

README

#Laravel Readable Make eloquent models readable

Introduction

For cases where you would like multiple users to be able to mark something as read. In somecases a read_at collumn can easily be added to a reasource table in order to store similar information, this package is for cases where this is not practical.

##Overview A reads table is created to keep track of read resources.

##Installation

  • Add "andheiberg/readable": "dev-master" to your composer.json
  • Run composer update
  • Run php artisan migrate --package="andheiberg/readable"
  • Add use \Andheiberg\Readable\Traits\IsReadable; inside every model you want to be readable

Usage

Congratulations! Now you can use read resources.

Examples

Now you can use it like a pro.

    /**
     * Mark a resource as read
     *
     * @var void
     */
    public function markAsRead()

    /**
     * Mark a resource as unread
     *
     * @var void
     */
    public function markAsUnread()

    /**
     * Limit query to read resources
     *
     * @var void
     */
    public function scopeRead($query, $user_id = null)

    /**
     * Limit query to unread resources
     *
     * @var void
     */
    public function scopeUnread($query, $user_id = null)
    Post::find(1)->markAsRead();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固