定制 muffin/multiselect 二次开发

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

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

muffin/multiselect

Composer 安装命令:

composer require muffin/multiselect

包简介

Toggle, select or multiselect a database field based on a set of conditions

README 文档

README

Build Status Coverage Total Downloads License

Toggle, select or multiselect a database field based on a set of conditions

Install

Using Composer:

composer require muffin/multiselect:1.0.x-dev

You then need to load the plugin. You can use the shell command:

bin/cake plugin load Muffin/Multiselect

or by manually adding statement shown below to your app's config/bootstrap.php:

Plugin::load('Muffin/Multiselect');

Usage

In a playlist, a single song can be play at the time. Whenever a song is marked as playing, all of the other songs are marked as not playing. for this we use the boolean field playing.

CREATE table songs(
    id int(10) unsigned NOT NULL auto_increment,
    title varchar(255) NOT NULL,
    playing tinyint(1) NOT NULL,
);

Load the behavior in your model SongsTable.php:

$this->addBehavior('Multiselect.Multiselect', ['playing']);

More complex use cases can be covered like the following. Where only 2 articles can be marked as featured at the time for the same author. When a third article is marked as featured, one of the 3 articles gets unfeatured. In this case, ordered by the least view count and by modification date.

$this->addBehavior('Multiselect.Multiselect', [
    'featured' => [
        'state' => true, 
        'scope' => ['author_id'],
        'limit' => 2,
        'order' => [
            'view_count' => 'ASC',
            'modified' => 'ASC',
        ],
    ],
]);

Configuration

  • [field_name] The name of the field used as select
  • state Either mark the active field as true or false
  • scope Selections can be grouped by fields defined here
  • limit Maximum number of selected elements
  • order Order in which to unselect fields when the limit is exceeded

Patches & Features

  • Fork
  • Mod, fix
  • Test - this is important, so it's not unintentionally broken
  • Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
  • Pull request - bonus point for topic branches

To ensure your PRs are considered for upstream, you MUST follow the CakePHP coding standards.

Bugs & Feedback

http://github.com/usemuffin/multiselect/issues

License

Copyright (c) 2015, Use Muffin and licensed under The MIT License.

muffin/multiselect 适用场景与选型建议

muffin/multiselect 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 muffin/multiselect 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 muffin/multiselect 我们能提供哪些服务?
定制开发 / 二次开发

基于 muffin/multiselect 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-09