定制 lanehub/laravel-bit-status 二次开发

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

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

lanehub/laravel-bit-status

Composer 安装命令:

composer require lanehub/laravel-bit-status

包简介

laravel orm bit status trait

README 文档

README

laravel orm bit status trait.

Build Status StyleCI build status

Installing

$ composer require lanehub/laravel-bit-status -vvv

Usage

Migrate database

$table->unsignedTinyInteger('status'); // 1 byte -> maximum of 8  different values
$table->unsigneInteger('status');      // 4 byte -> maximum of 32 different values
$table->unsignedBigInteger('status');  // 8 byte -> maximum of 64 different values

Add trait

use Illuminate\Database\Eloquent\Model;
use Lanehub\LaravelBitStatus\BitStatusTrait;

class TestModel extends Model
{
    const STATUS_INFO_COMPLETED = 1;   // 0001
    const STATUS_AVATAR_COMPLETED = 2; // 0010
    const STATUS_DESC_COMPLETED = 3;   // 0100
    const STATUS_FOO_COMPLETED = 4;    // 1000

    use BitStatusTrait;
}
$test = new TestModel;

$test->setBitStatus('status', TestModel::STATUS_AVATAR_COMPLETED);  // default set true
$test->setBitStatus('status', TestModel::STATUS_AVATAR_COMPLETED, true); // same as above
$test->getBitStatus('success', TestModel::STATUS_AVATAR_COMPLETED); // true


$test->setBitStatus('status', TestModel::STATUS_AVATAR_COMPLETED, false); // set false
$test->getBitStatus('status', TestModel::STATUS_AVATAR_COMPLETED); // false

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固