bscheshirwork/yii2-gui-acyclic-graphs

Yii 2 模型管理 GUI 界面

2.0.8 2018-06-13 11:01 UTC

This package is auto-updated.

Last update: 2024-09-08 06:43:42 UTC


README

例如,对于下一个组合

/**
 * @property MainModel[] $parents
 * @property MainModel[] $childs
 */
class MainModel extends \yii\db\ActiveRecord
{
    var $id;
}
/**
 * @property MainModel $parent
 * @property MainModel $child
 */
class RelationModel extends \yii\db\ActiveRecord
{
    var $parentId;
    var $childId;
}

通过表属性可以前缀 parentchild,可以接受复杂的 pk;

图形表示和操作

default

githubjeka/yii2-gui-rbac 类似

http://i.imgur.com/BXTKymp.jpg

如何安装

遵循以下命令

  • 将以下代码添加到您的 composer.json 中 "bscheshirwork/yii2-gui-acyclic-graphs": "*@dev"
  • 运行 composer update
  • 将以下代码添加到 config
// '/config/web.php' for Basic or '/backend/config/main' - Advanced Yii2 application.
'modules' => [
    'gui' => [
        'class' => 'bscheshirwork\gui\Module',
        'as access' => [ // if you need to set access
            'class' => 'yii\filters\AccessControl',
            'rules' => [
                [
                    'allow' => true,
                    'roles' => ['@'] // all auth users 
                ],
            ],
        ],
        'mainModel' => 'common\models\MainModel', // model, who have relations. (rectangles)
        'mainModelFormView' => '@backend/views/main-model/_form-gui', //Active form for MainModel. See @vendor/bscheshirwork/yii2-gui-acyclic-graphs/src/views/default/_form
        'relationModel' => 'common\models\RelationModel', // via model (arrows)
        'arrowDirection' => bscheshirwork\gui\Module::PARENT_TO_CHILD, // direction of arrow representation
    ],
],
  • 转到 URL /index.php?r=gui