wangdong/laravel-cumuli

Cumuli系统 - Laravel扩展包


Keywords
laravel, wangdong, cumuli
Licenses
MIT/GPL-2.0+

Documentation

laravel-cumuli

Latest Stable Version Latest Unstable Version Total Downloads License composer.lock available

Cumuli系统 - Laravel扩展包

捐赠作者

支付宝捐赠

安装

composer require wangdong/laravel-cumuli

配置

修改laravel配置文件 config/app.php,$providers数组添加如下配置

Cumuli\Support\ServiceProvider::class,

修改laravel composer配置文件composer.json,添加一行module配置

"autoload": {
        "classmap": [
            ...
            "module"
        ],
...

安装

php artisan cumuli:install

升级

composer update
php artisan cumuli:install

工作流

只需要在当前model中定义下面代码 (版本>= 2.0.0)

// 绑定工作流,与flow表code对应
public $flowCode = '24002133e3';

// 事件监听
protected $dispatchesEvents = [
    'created' => \Cumuli\Events\FlowBindEvent::class,
];

/**
 * 多态关联工作流
 * @return \Illuminate\Database\Eloquent\Relations\MorphMany
 */
public function progresses()
{
    return $this->morphMany('Cumuli\Model\FlowProgress', 'task');
}

当通过该model创建新的数据后,只需前端调用以下代码

// id 为flow_progresses表主键id,php可通过$model->progresses获取数据中的id字段
$.cumuli.flow.dialog(null, {flow: id}).then(success, error)