bfg/wood

Laravel 高级框架控制器,用于代码生成,快速轻松地更改框架。使用最佳代码生成器自动化所有相同任务。

维护者

详细信息

github.com/bfg-s/wood

源代码

问题

安装: 103

依赖项: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 1

开放问题: 0

类型:bfg-app

1.3.0 2023-12-24 18:07 UTC

README

安装

composer require bfg/wood

描述

Laravel 高级框架控制器,用于代码生成,快速轻松地更改框架。使用最佳代码生成器自动化所有相同任务。

JSON 模式演示

Wood json demo

快速开始

为了以 JSON 格式开始生成,运行 php artisan wood:install 命令以创建生成器数据库,然后使用 php artisan wood:import 命令创建一个 JSON 文件。之后,在你的 database 文件夹中会出现一个 wood.json 文件。在其中,你根据方案描述你的文件。一旦方案完成,我们调用 php artisan wood:build 命令来收集所有更改。每次更改方案时,jason 都会运行 php artisan wood:build 命令。

命令

  • php artisan wood:install - 设置生成器的初始数据库
  • php artisan wood:run - 开始生成过程
  • php artisan wood:build - 从 JSON 文件构建数据
  • php artisan wood:import - 从表中导入所有数据并创建 JSON 文件
  • php artisan wood:sync - 将现有模型的主数据同步到表中

JSON 结构

  • <value> - 默认数据
{
    "models": [
        {
            "class": "string",
            "foreign": "string<id>",
            "increment": "bool<true>",
            "auth": "bool<false>",
            "created": "bool<true>",
            "updated": "bool<true>",
            "deleted": "bool<true>",
            "migration": "bool<true>",
            "fields": [
                {
                    "name": "string",
                    "cast": "string<string>",
                    "type": "string<string>",
                    "type_parameters": "array<[]>",
                    "has_default": "bool<false>",
                    "default": "string<null>",
                    "hidden": "bool<false>",
                    "nullable": "bool<false>",
                    "unique": "bool<false>",
                    "index": "bool<false>",
                    "comment": "string<null>",
                    "type_details": "array<[]>"
                }
            ],
            "relations": [
                {
                    "related_model": "class",
                    "name": "string<null>",
                    "type": "string<hasOne>",
                    "reverse_name": "string<null>",
                    "reverse_type": "string<hasMany>",
                    "able": "string<null>",
                    "with": "bool<false>",
                    "with_count": "bool<false>",
                    "nullable": "bool<false>",
                    "cascade_on_update": "bool<true>",
                    "cascade_on_delete": "bool<true>",
                    "null_on_delete": "bool<false>"
                }
            ],
            "observers": [
                {
                    "class": "string",
                    "events": "array"
                }
            ],
            "traits": [
                {
                    "class": "string"
                }
            ],
            "implements": [
                {
                    "class": "string"
                }
            ]
        }
    ],
    "events": [
        {
            "class": "string",
            "listeners": [
                {
                    "row": "string"
                }
            ]
        }
    ],
    "controllers": [
        {
            "class": "string",
            "methods": [
                {
                    "row": "string",
                    "event": "class"
                }
            ]
        }
    ],
    "factories": [
        {
            "model": "class",
            "lines": [
                {
                    "field": "string",
                    "php": "string<null>"
                }
            ]
        }
    ],
    "seeds": [
        {
            "class": "string",
            "model": "class",
            "factory": "bool<false>",
            "count": "int<1>",
            "rows": [
                {
                    "row": "array"
                }
            ]
        }
    ],
    "requests": [
        {
            "class": "string",
            "access": "string<'true'>",
            "rules": [
                {
                    "name": "string",
                    "rules": "array"
                }
            ]
        }
    ],
    "resources": [
        {
            "class": "string"
        }
    ]
}

应用程序文档

我们提供了丰富的 文档,您可以在其中了解 bfg wood。

应用程序演示

Wood demo

更多详情。

https://wood.veskod.com/